Boost logo

Boost :

From: Manfred Doudar (manfred.doudar_at_[hidden])
Date: 2008-03-24 06:41:20


On Sun, 23 Mar 2008 23:07:57 -0700
Eric Niebler <eric_at_[hidden]> wrote:

> Tom Brinkman wrote:
> >>> Now that I think about it some more, there's really nothing
> >>> stopping us
> >> >from taking this much farther -- access individual characters,
> >> >calculate
> >>> the length, slice and substr, even search and replace. There's no
> >>> reason why ctstring<> can't implement most of the std::string
> >>> interface at compile time.
> >
> > This would be great showcase of the advanced work being done
> > by boost developers. This would have a "high" wow factor.
> >
> > I bet, the vast horde of "old-style" c++ developers what immediately
> > step up and take notice.
>
> I fleshed out the compile-time string class, and called it
> mpl::string. (See attached.) It is a Front and Back Extensible,
> Random-Access MPL Sequence. The primary use is as follows:
>
> template<char const *sz> // template on a string
> struct foo
> {
> void bar() { std::printf("%s\n", sz); }
> };
>
> foo< mpl::string<'hell','o wo','rld!'>::c_str > f;
> f.bar(); // prints "hello world!"
>
> Is there interest in adding this to the MPL?
>

Yes please.

Was looking at working your earlier post into something more
elaborate ... but oh well - though have only skimmed over your present
post.

P.S. I presume you'd wrap the mpl_max_string_length around some
ifdef for a user compile-time defined value.

Please, let's get this into the mpl.

Cheers,

-- 
Manfred
24 March, 2008

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