Boost logo

Boost :

Subject: Re: [boost] [Range] Boost and N2930?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-08-04 05:00:37


Beman Dawes skrev:
> N2930, Range-Based For Loop Wording (Without Concepts), provides begin()
> and end() non-member function templates for standard library types. It
> also provides general range access non-member templates:
>
> // 24.7 range access [iterator.range]
> template<typename C> auto begin(C& c) -> decltype(c.begin());
> template<typename C> auto begin(const C& c) -> decltype(c.begin());
> template<typename C> auto end(C& c) -> decltype(c.end());
> template<typename C> auto end(const C& c) -> decltype(c.end());
> template<typename T, size_t N> T* begin(T (&array)[N]);
> template<typename T, size_t N> T* end(T (&array)[N]);
>
> (Until the official WG21 site gets updated, you can see a copy of n2930
> at http://mysite.verizon.net/beman/n2930.html)
>
> Should Boost.Range and/or RangeEx be modified and/or extended in light
> of N2930?

Maybe. I always imagined that the availability of decltype + auto +
perfect forwarding should be used to simplify the library somewhat.

Once implementations start to ship the new standard lib components, we
could start to do like boost::swap, calling std::begin/std::end internally.

> Can Boost.Range, RangeEx, or some other Boost component help developers
> and users who want to take advantage of N2930 in C++03 now, and do so in
> a way that transitions smoothly to C++0x as language and library available?

Doing like the above, seems to be the right thing to do. We really want
boost::begin/boost::end to be customization points.

-Thorsten


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