templated operator<<() problems

Hello,
for formatting output I wrote the following classes:
---8<---
namespace /* anonymous */ {
namespace mpl = ::boost::mpl;
using ::boost::enable_if;
using ::boost::xpressive::sregex;
using ::boost::xpressive::as_xpr;
template<typename StringT>
struct is_string : mpl::false_ { };
template<>
struct is_stringstd::string : mpl::true_ { };
template

AMDG Olaf Peter wrote:
Anyway, overloading global operator<<() as
template<typename T> static inline std::ostream& operator<<( std::ostream& os, const T& rhs ) { return rhs.write_on( os ); }
would force all to have a write_on member function, isn't it. Is there a way around and even use operator<<() notation ??
I'm not sure I understand what you're trying to achieve. If you only want the overload to be found for formatters, say template<typename T> inline std::ostream& operator<<( std::ostream& os, const formatter<T>& rhs ) { return rhs.write_on( os ); } In Christ, Steven Watanabe

I'm not sure I understand what you're trying to achieve. If you only want the overload to be found for formatters, say
template<typename T> inline std::ostream& operator<<( std::ostream& os, const formatter<T>& rhs ) { return rhs.write_on( os ); }
Yes that's is; it was yesterday too late in the evening. Thanks, Olaf
participants (2)
-
Olaf Peter
-
Steven Watanabe