Boost logo

Boost :

From: Alexei Novakov (alexei_novakov_at_[hidden])
Date: 2002-11-25 10:49:07

"John Maddock" <jm_at_[hidden]> wrote in message
> Alexei,
> Looks like we're all thinking alike, a while ago I put together a sequence
> based substring class that could act as a universal wrapper for any string
> like object, along with a set of algorithms to act upon it: it's based
> loosely on Darin Adler's original string algorithm code.

I took a look at your classes, it really looks very similar to my sub
string. Only big difference I can see now is you sub string looks like a
basic_string and mine IS a basic_string. Practical advantage it gives is an
ability to use most of string algorithms and utilities for sub strings as
well without changing anything on the utility side. I was looking at
standard basic_string to be "universal wrapper for any string like object",
which provides standard interface and can be "overriden" with all kinds of
template specializations. This interface is not always very generic and
flexible, but still suitable.

> classes:
> string_traits: this is the glue that allows the classes and algorithms to
> act upon any string like object (std::string, char*, other string classes
> etc)
> basic_substring: an immutable view of any string like object (or iterator
> sequence).

string_traits could give more flexibility to template specializations
definately, I will look into it.

> Algorithms returning a substring:
> rtrim
> ltrim
> trim
> Algorithms returning a new string:
> make_upper
> make_lower
> Inplace transformations:
> inplace_ltrim
> inplace_rtrim
> inplace_trim
> inplace_make_upper
> inplace_make_lower
> And then I ran out of time... :-)
> I've put what I have at
> it's actually pretty complete with full test cases etc, but I'm not sure
> where this would fit in with the proposed new string lib, plus I'm pretty
> short of time at present. Still I'm hoping someone can make use of this
> maybe the new string lib can include a synthesis of all these ideas...

I have uploaded my sub string to Take a look at it
if interested.

> John Maddock

Alexei Novakov

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