|
Boost Users : |
From: John C. Femiani (john.femiani_at_[hidden])
Date: 2008-07-23 16:15:46
Gennadiy Rozental wrote:
> Michiel Helvensteijn <m.helvensteijn <at> gmail.com> writes:
>
>> Hm, yes. You're afraid they will change the structure of that namespace from
>> under our feet without even putting it in a changelog.
>>
>> Given that possibility, might it not be better to put it in namespace std
>> anyway...
>>
>> Perhaps they should offer us a real solution in the next version?
>>
>
> 'They' are open to any suggestions ;)
>
> Gennadiy
>
>
I suggested that boost should actually only print adapters to the
stream. The default behavior would be to
template<class T>
struct repr_type{
typedef T type;
T make(T value) {return value;}
};
template<class T>
typename repr_type<T>::type repr(T& value) {
return repr_type<T>::make(value);
}
Then to print log messages:
stream << repr<>(obj1) << repr<>(obj2);
and to customize output when overloading operator << is not possible,
you can use template specialization.
template<class T> struct repr_type<std::vector<T> > {...}
--John
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