joboccara / NamedType

Implementation of strong types in C++
MIT License
773 stars 85 forks source link

better operator<< with std::basic_ostream #15

Open gicutza opened 6 years ago

gicutza commented 6 years ago

`template struct Printable : crtp<T, Printable> { template void print(std::basic_ostream& os) const { os << this->underlying().get(); } };

template <typename CharT, typename T, typename Parameter, template class... Skills> std::basic_ostream& operator<<(std::basic_ostream& os, NamedType<T, Parameter, Skills...> const& object) { object.print(os); return os; }`