Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-10-13 08:58:48


Martin Adrian wrote:
> shams <shams <at> orcon.net.nz> writes:
>
>> The thing is that if you don't want to use it then dont, but atleast these
>> string functionalities should be available with ease for all including novices
>> and experianced programmers. Something like super_string in Boost could be
>> received quite well by the boosters community and could increase popularity
>> of Boost even between novice and experianced developers.
>
> What if a module need to use some super_string functions. If it then takes a
> super_string as argument, all modules using this library need to include headers
> for regex and string_algo and all their dependencies.

Yep. But it's all template so if you don't use regex you don't have to link it.

> The alternative is to take the argument as basic_string and then copy it into a
> superstring to do the processing.

Yes, it will run the basic_string copy constructor in this case.

>> Why should something like trimming, uppercasing, lowercasing
>> should be so hard in C++.
>
> Why is
>
> boost::super_string ss(s)
> ss.trim()
>
> easier than
>
> boost::trim(s)

It isn't -- except which header do you include again? And you have to
remember that half the functions you might use are free functions while the
other half are member functions.

We had a long discussion of this in the summer. In short, for me, it's having
all the functions in one place. The signature for more advanced regex
functions are much simpler with super_string. Many people don't even realize
what's already in Boost (see other discussion in this thread). Also see:

http://www.crystalclearsoftware.com/libraries/super_string/index.html#decisions

Most of this started for me when I had to write some string code and Java --
it was nice to not have to run around to 3 places to see string function docs.
  I *know* C++ is just as powerful as Java, but there's a big mental impedance
(even for me) in C++ because you have to look at 4 libraries (regex, format,
lexical_cast, string_algo) to do what Java String and super_string do in one
place. I find I'm doing these things together, so I find it's *slow* to be
jumping around to find the docs, examples, etc.

> Many other langages (specially entry-level like VB) only have free functions for
> string processing.

Sure.

> I agree that the string_algo library is a bit difficult to get into but solving
> that with a new library isn't the right way.
>
> Why not a string_algo wiki where users can add their own real-world examples of
> how you do things with it.

We've had a Boost user wiki for 5 years so frankly I'm not holding my breath.
  Plus I don't *really* care about examples, the string_algo docs are plenty
good for me. I care about the code that I write. I'm satisfied that with
super_string I can write cleaner, clearer string manipulation code -- readable
by c++ novices.

http://www.crystalclearsoftware.com/libraries/super_string/index.html#code_examples

Jeff


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