Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-18 06:48:34

John Nagle wrote:
> With no base class for all fixed_string types, though,
>there's no way to pass fixed_string objects around, short
>of templating every function that uses them.
> A base class seems to be needed. Otherwise, there's
>no direct replacement for "char *" arguments.

I have uploaded an initial version of this. I wanted to wait before I
approached the base class concept for two main reasons: (a) I wanted to move
the interface closer to that of std::basic_string and (b) I wasn't sure how
to implement it as a template on character type.

The interface names have been moved to the corresponding basic_string/STL
names (assign, append, etc.).

The approach I have used for the base classes retains the template on
character type, using MPL machinery to select the appropriate base class.
Note that this is not perfect, since I still need a constraint to limit
CharT to char and wchar_t, or provide an additional template parameter that
defaults to the MPL machinery, allowing you to provide your own interface
for custom string types.

> Here's a simple test program. It should be possible
>to do the common operations done here. That doesn't
>seem possible with the latest version in the Boost

This should work with the appropriate name changes:
   boost::char_string is now boost::fixed_string (although it still
currently resides in fixed_string/char_string.hpp);
   boost::char_string_base is boost::char_string for readability;
   boost::wchar_string_base is boost::wchar_string for readability;


Express yourself with cool new emoticons

Boost list run by bdawes at, gregod at, cpdaniel at, john at