|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-11-17 11:36:35
Hi Pavol, I haven't been following this thread so please forgive me if
I'm just pointing out something stupid, or problems that you already
know. I had a quick glance at the library and I'm a little confused at
what is its scope. For instance the "is space" generalization makes in
fact functions like trim() and the like generic algorithms that remove
a given element (or its equivalents) from the beginning and the end of
a sequence. At this point either you make clear that the library isn't
specifically a "string library" or that isspaceF is actually a generic
functor that can test whatever charT you like (and change its name at
least).
>Trimming:
>
> Iterator trim_begin( Iterator InBegin, Iterator InEnd, const std::locale& Loc=std::locale() )
> Seq ltrim( const Seq& Input, const std::locale& Loc=std::locale() )
> Seq& ltrim_in( Seq& Input, const std::locale& Loc=std::locale() )
> Seq rtrim( const Seq& Input, const std::locale& Loc=std::locale() )
> Seq& rtrim_in( Seq& Input, const std::locale& Loc=std::locale() )
> Seq trim( const Seq& Input, const std::locale& Loc=std::locale() )
> Seq& trim_in( Seq& Input, const std::locale& Loc=std::locale() )
This is in accordance with my confusion :-) What has a locale to do
with a generic sequence? If I imagine a generalized trim function
(say, a function that removes all the odd numbers from the beginning
and the end of a vector<int>) I imagine, type requirements about the
iterators etc. aside, signatures like:
template <typename Iterator, typename Elem>
Iterator trim (Iterator start, Iterator end, Elem const &);
template <typename Iterator, typename Pred>
Iterator trim (Iterator start, Iterator end, Pred pred);
It seems that either the design is seriously flawed or (more likely)
I'm missing something.
Genny.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk