Boost logo

Boost :

From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2002-05-13 06:52:22


----- Original Message -----
From: "Dirk Gerrits" <dirkg_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, May 13, 2002 12:18 AM
Subject: Re: [boost] String formatting library: interest?

> How about this?
>
> template<class charT, class traits = char_traits<charT> >
> class mystring : private std::basic_string<charT, traits>
> {
> typedef std::basic_string<charT, traits> base_type;
> public:
> using base_type::begin;
> using base_type::end;
> using base_type::rbegin;
> using base_type::rend;
> using base_type::size;
> // etc etc etc
>
> operator const base_type& (); // implicit conversion
> }
>
> [Sorry if I got anything wrong but it's getting late here. ;)]

Yes, should work. I just have a bad feeling about inheriting from the
standard library (too many implementations), I feel we could be much more
compatible without it.

> boost::string someString = "blablabla";
> someString += someObject;

> Don't get me wrong though, I like the format() idea. But I think that a
> custom string class could add just a bit more functionality.

Yes, I agree that the syntax above is the best one. I didn't have this need,
but I understand that other people might. And also, I agree that setting up
boost::string is useful in that we can add more missing features to it if
they come up, while format() only serves the purpose of string formatting.
So yes, it seems that a type is necessary, as we are sliding from a
formatting library to a std::string extension library.

Giovanni Bajo


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