Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-04-19 10:42:13


Andy Little wrote:
> I dont understand the char_type member typedef of the traits class. The
> functions that use it all seeem to be free functions which could change from
> e.g
>
> template<class Ptree>
> void read_xml(std::basic_istream<typename Ptree::char_type> &stream,
> Ptree &pt,
> int flags = 0);
>
> to
>
> template<class Ptree, class Char>
> void read_xml(std::basic_istream<Char> &stream, Ptree &pt,int flags = 0);
>
> without problems. That would remove one level of coupling wouldnt it?

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.

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 );
}

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk