|
Boost : |
Subject: Re: [boost] [range] [extensions] Default values for range access adaptors?
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2013-06-08 07:51:03
Hi Yusuke,
2013/6/8 Yusuke Ichinohe <valp_ab_at_[hidden]>
> Hi Michel, Akira,
>
> I think simpler solution would be to add range support for
> boost::optional in additional header (e.g.
> <boost/range/range/optional.hpp>).
> i.e. boost::optional will become random access range.
>
> // OK
> #include <boost/range/range/optional.hpp>
> for (T x : r | optional_front()) {
> std::cout << x << std::endl
> }
>
> // also OK
> if (optional<T> x = r | optional_front()) {
> std::cout << x.get() << std::endl;
> }
>
> // another example:
> #include <boost/range/range/optional.hpp>
> optional<int> x = 100;
> assert(boost::size(x) == 1);
> optional<int> y = boost::none;
> assert(boost::size(y) == 0);
>
> Thanks.
Thank you for your comment.
That's good idea! I agree first design.
But I think need more vote.
Thanks,
Akira
>>========================
Akira Takahashi
mailto:faithandbrave_at_[hidden]
https://sites.google.com/site/faithandbrave/about/en
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk