
Andy Little wrote:
"Thorsten Ottosen" wrote
I'm not sure it is worth speculating too much about coupling. The function will implicitly depend on the interface of basic_ptree<> anyway. So there is no reason to hide that fact.
The only resaon for the char_type traits parameter is for stream I/O though isnt it? IOW because of this coupling each ptree type can only be serialised to a stream parameterised on one char type. You cannot therefore have a wide string ptree loaded from a char file for example.
I consider this interface most elegant (because ADL also works):
namespace boost { template< class Traits > void read_xml( std::basic_istream<typename Traits::char_type>& str, basic_ptree<Traits>& tree, int flags = 0 ); }
ADL also works ...
namespace boost { template< class Traits , typename Char> void read_xml( std::basic_istream<Char>& str, basic_ptree<Traits>& tree, int flags = 0 ); }
I see you point, but I'm not qualified to tell you if it makes sense for Char and Traits::char_type to be different. Marcin? -Thorsten