|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-03-14 03:08:37
"Pavol Droba" <droba_at_[hidden]> wrote in message
news:20050314072940.GE7893_at_lenin.felcer.sk...
| Hi,
|
| On Sun, Mar 13, 2005 at 10:04:05PM -0800, Eric Niebler wrote:
| > Solution:
| >
| > I suggest the functions copy_range() and transform_range() should be
| > removed or moved into a "deprecated" namespace, freeing up the
| > identifier "boost::transform_range" to be a type, analagous to
| > boost::transform_iterator. Development should proceed on a range-based
| > algorithms library to fill the need that the existing
| > "transform_range()" function is meeting.
| >
| > Thoughts?
| So instead of
|
| str=copy_range<std::string>(aRange);
|
| You need to write
| str=std::string(aRange.begin(), aRange.end());
|
| The second one is not as nice, but what is more important, it disallows
| you to pass a range by value in a chain. In other words, you cannot
| write
|
| str=copy_range<std::string>(find_first(input,"helo"));
|
| To sumarize, copy_range is an essential utility, that provides a way of
| copying between different range types, especialy the legacy ones like
| std::string. Therefor it has an important place in the Boost.Range
| library.
there is one alternative which might make copy_range less needed too.
We could put this into sub_range<T>:
operator T() const
{ return T( begin(), end() ); }
So if you really want range2container conversion, you must use a
sub_range<string>:
str = sub_range<std::string>( find_first(intput, "jello" ) );
Anyway, I agree with Eric that the transform_range should go away.
Eric, feel free to remove it or say if I should do it.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk