Boost logo

Boost Users :

Subject: Re: [Boost-users] [Review] Reminder: Boost.RangeEx review is going on
From: Peter Barker (newbarker_at_[hidden])
Date: 2009-03-02 09:55:07


> If you feel this is an interesting library, then please submit your review
> to the developer list (preferably), or to the review manager.

I'm not a member of the developer list, so I'm sending this to the
Boost.User's list and Thorsten Ottosen. Hope that's ok.

> Here are some questions you might want to answer in your review:
>
> - What is your evaluation of the design?

I really like it. It's feels very expressive. I wish something like
this was available a long time ago.

> - What is your evaluation of the implementation?

I didn't look into the source code.

> - What is your evaluation of the documentation?

Found some very small mistakes in
http://www.cs.aau.dk/~nesotto/boost/libs/range/doc/adaptors.html.

1) "where added to be equivalent" should be "were added to be equivalent".
2) "The answer is readbility" should be "The answer is readability".
3) code snippet where the virtues of using operator |() are extolled
shows "boost::adaptors::unique" but it should be
"boost::adaptors::uniqued".
4) "satisfies that predicated" should be "satisfies that predicate".

> - What is your evaluation of the potential usefulness of the library?

I think it'll be very useful and will make code more readable. Rather
than fiddling with the boundaries of ranges, you can just use the
range.

If a function returns a STL-compliant container which I need to do
something with, I currently have a const& to the returned container,
then do something with its begin() and end(). Now I can just get on
and do whatever I need to do directly on the return value.

> - Did you try to use the library? With what compiler? Did you have any
> problems?

I did. I used Microsoft Visual Studio 7.1 (2003 with SP1) and Boost 1.38.0.

I went through the most of the adaptors and tried out the examples.

Didn't really understand the difference between the adaptors "copied"
and "sliced". Is there any?

I took the example on the replaced adaptors page
(http://www.cs.aau.dk/~nesotto/boost/libs/range/doc/adaptors/replaced.html)
and modified it for std::string. It failed to compile on MSVC7.1
(2003). Here's the code:

#include <boost/range/adaptor/replaced.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/assign.hpp>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

int main(int argc, const char* argv[])
{
    using namespace boost::adaptors;
    using namespace boost::assign;

        std::vector<std::string> input;
    input += "1","2","3","2","5","2","7","2","9";

    boost::copy(
        input | replaced("2", "ten"),
                std::ostream_iterator<std::string>(std::cout, ","));

    return 0;
}

And here's the compilation error:

Compiling...
main.cpp
c:\cpp\RangeExTest\main.cpp(18) : error C2679: binary '|' : no
operator found which takes a right-hand operand of type

'boost::range_detail::replace_holder<T>' (or there is no acceptable conversion)
        with
        [
            T=const char *
        ]

Perhaps I'm not doing something correctly? I understand that "2" and
"ten" are not std::string objects, but they are implicitly
convertible.

The example for the transformed adaptor doesn't compile because
<boost/range/assign.hpp> doesn't exist. Should be <boost/assign.hpp>.

> - How much effort did you put into your evaluation? A glance? A quick -
> reading? In-depth study?

It was a quick-reading.

> - Are you knowledgeable about the problem domain?

Fairly. I've been using STL containers and algorithms for over 5 years.

> And finally, every review should answer this question:
>
> - Do you think the library should be accepted as a Boost library?

Yes.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net