|
Boost : |
Subject: Re: [boost] [RangeEx] Where is the current version?
From: Neil Groves (neil_at_[hidden])
Date: 2010-04-19 03:14:39
> 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>'"
>
>
Almost every Boost.Range adaptor test case has using namespace
boost::adaptors. These tests are all passing on VC10 on our trunk testing
mechanism. This problem is therefore not as obvious and simple to reproduce
as you may have estimated. Would you please raise a trac issue with some
source code?
> 2) Stride adaptor.
> I tried :
> > std::vector<int> v2;
> > boost::push_back(v2, v | boost::adaptors::sliced(0, 5) |
> boost::adaptors::strided(2) );
>
>
This fails because 5 - 0 = 5 and 5 is not even. You would need to use
boost::adaptors::sliced(0,6) for the result you are expecting.
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"
>
>
This result is as expected for the code you have supplied.
> 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.
>
>
This report almost gave me heart failure! I have written a test case (which
is yet to be submitted) that does support free functions. It is not correct
that transformed does not support free functions.
It may well be true that the C++0x lambdas don't work well. This would be
frustrating and I will look into this when I have some time. If I can fix
this easily I shall attempt to get this into the release as a defect fix.
> Should I file some ticket about this three points ?
>
Yes please and with lots of sample code!
>
> Regards.
>
> 2010/4/18 Thomas Petit <thomas.petit33_at_[hidden]>
>
> Thank you for your feedback,
Neil Groves
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk