
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Steven Watanabe Sent: Wednesday, August 08, 2012 3:29 PM To: boost@lists.boost.org Subject: Re: [boost] [type_erasure] Review started (July 18-27, 2012)
AMDG
On 08/08/2012 02:09 AM, Paul A. Bristow wrote:
namespace boost { namespace type_erasure {
// Partial specialization of struct ostreamable: template<class Os> struct ostreamable<Os, std::pair<const int, double> >;
} // namespace type_erasure } // namespace boost
looks more promising but still fails inside the magic of type_erasure.
You still need the definition. I only posted the declaration because the body of the specialization that you had looked okay.
Ah yes - of course. This now works fine (templated too) provided the function template <typename T1, typename T2> std::ostream& operator<< (std::ostream& os, const std::pair<T1, T2>& p) { ...} lives in namespace boost::type_erasure. But really I'd like it to live in my_detail namespace or it will be confusing for other uses outside type_erasure/any things. putting the operator<< for pair in namespace my_detail and using my_detail::operator<<; in namespace boost::type_erasure before the partial specialization of ostreamable seems to permit this. Even more than often, when using boost::type_erasure, namespace issues seem likely to be an unwelcome complication and source of puzzling behaviour :-( Perhaps some warnings for the unwary might be helpful. For one example, I was confused at first by having the same name like any and tuple in more than one namespace. Many thanks Paul PS I haven't found the docs on ostreamable Error 503 Service Unavailable Service Unavailable Guru Meditation: XID: 731432893 Varnish cache server No doubt a release will provide. ostreamable will, no doubt, be a very popular requirement. Examples will be invaluable, perhaps links to the \tests\test_stream.cpp (for example) might be a quick way of providing many more examples? PPS The error messages a dreadfully inscrutable :-( I've not even found the line number causing the problem in many cases. But perhaps that is inevitable? --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com