Open HerbertKoelman opened 7 years ago
In C++14 you can use the following template to print any object which has a T::print(std::ostream&)const; member.
template auto operator<<(std::ostream& os, const T& t) -> decltype(t.print(os), os) { t.print(os); return os; }
In C++14 you can use the following template to print any object which has a T::print(std::ostream&)const; member.
template
auto operator<<(std::ostream& os, const T& t) -> decltype(t.print(os), os)
{
t.print(os);
return os;
}