|
Boost Users : |
Subject: [Boost-users] [log] operator<< best practices
From: Yi Ding (yi.s.ding_at_[hidden])
Date: 2013-07-16 18:52:40
I noticed boost log has a helper function for operator<<
template< typename CharT, typename TraitsT, typename AllocatorT, typename T
>
inline basic_formatting_ostream< CharT, TraitsT, AllocatorT >&
operator<< (basic_formatting_ostream< CharT, TraitsT, AllocatorT >& strm, T
const& value)
{
strm.stream() << value;
return strm;
}
which is useful because a lot of code has operator<< overloads specifically
for std::ostream.
Recently we've moved our code to use a generic
template <class stream, int N>
inline stream& operator<<(stream& os, const BlahClass& value)
which conflicts with the boost log helper function, but is useful for our
own ostream-like classes.
What's the best practice here? Can we make the two mesh by using traits of
some sort? Should we do all of our type to string conversions ahead of
time using something like folly::to?
Cheers,
Yi
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net