Boost logo

Boost :

Subject: Re: [boost] [RangeEx] Where is the current version?
From: Thomas Petit (thomas.petit33_at_[hidden])
Date: 2010-04-18 19:25:45


More comments :

My compiler is vs2010 :
for the bullet 2) and 3) I set up this code :

> #include <vector>
> #include <boost/range/algorithm.hpp>
> #include <boost/range/algorithm_ext.hpp>
> #include <boost/range/adaptors.hpp>
> #include <boost/range/adaptor/strided.hpp>
> int main()
> {
> int ar[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
> std::vector<int> v(ar, ar+10);
> ...
> }

1) Put "using namespace boost::adaptors" brings havoc.
Even with an empty main, just write :
> #include <boost/range/adaptors.hpp>
> using namespace boost::adaptors;
and then the compiler emits some strange compilation error :
"program files\boost\boost\range\iterator.hpp(63):
error C2039: 'type' : is not a member of 'boost::mpl::eval_if_c<C,F1,F2>'"

2) Stride adaptor.
I tried :
> std::vector<int> v2;
> boost::push_back(v2, v | boost::adaptors::sliced(0, 5) |
boost::adaptors::strided(2) );

I expected that my initial set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} get sliced to
{1, 2, 3, 4, 5}
and then strided to {1, 3, 5}. But I actually got an MSVC assert :
"Expression : vector iterator not dereferencable"

3) Transform adaptor.
Isn't there a way to deduce the return type instead of relying on the
typedef return_type ?
My first impulse was to tried a lambda:
> std::vector<int> v3;
> push_back(v3, v | transformed([](int i){ return i * 10;} );
But it failed because of the lack of return_type typedef inside the lambda.
And actually, even without fancy lambdas, it means that a simple free
function will fail too.

Should I file some ticket about this three points ?

Regards.

2010/4/18 Thomas Petit <thomas.petit33_at_[hidden]>

> Wait ! Did you just wrote that RangeEx is now at last in the trunk and
> ready for 1.43 ?
> That's freaking great !
>
> Two comments :
> 1) Maybe a small oversight* *in boost/range/adaptors.hpp : all adaptors
> are included except the strided one.
> 2) Is there somewhere in RangeEx some shortcuts to construct a standard
> container directly from a range ?
> Something along the line of :
>
> namespace boost
> {
> template <typename Range>
> std::vector<typename Range::value_type>
> make_vector(Range& rng)
> {
> return std::vector<typename Range::value_type>(boost::begin(rng),
> boost::end(rng));
> }
> }
>
> int main()
> {
> std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
> std::vector<int> v2 = boost::make_vector(v |
> boost::adaptors::strided(2));
> }
>
> Regards.
>
> 2010/4/17 Neil Groves <neil_at_[hidden]>
>
> On Fri, Apr 16, 2010 at 9:52 PM, Thomas Petit <thomas.petit33_at_[hidden]
>> >wrote:
>>
>> > As the title said :
>> > Where is the current version ? :)
>> >
>> > It is on the trunk. All you need to do is checkout the trunk from
>> subversion. Boost.Range has all the RangeEx functionality merged in. I am
>> targeting a release in 1.43
>>
>>
>> > It seems to have vanished from the vault !?
>> > I can't find any trace here anymore :
>> >
>> >
>> http://www.boostpro.com/vault/index.php?&direction=0&order=&directory=Algorithms
>> >
>> > Yes it has. I remove it to avoid anyone getting the older version before
>> the improvements due to review feedback.
>>
>> Regards,
>> Neil Groves
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>
>
>


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