Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] questions about documentation and usage
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2012-11-04 16:01:23


Hi,

> looking through http://en.cppreference.com/w/cpp/concept
> it seems that swappable/valueswappable is a very unusual
> and perhaps even unique case. I suspect this would be for
> the same reason that boost::begin(A) as a required expression
> raised a red flag when I looked at it. This technique/practice
> creates a concept which I can't easily verify. A couple of
> other points.
>
> a) I don't think it (boost::begin()) is necessary to implement
> the library.
Why do you think that? in fact the implementation using free standing
begin() and end() functions as a mean for adapting third party
containers was deemed so necessary that the standard commitee
implemented the c++11 range based for in terms of begin(v) and end(v)
and not in v.begin() and v.end(). Think about that: adding the required
specialisation of boost::begin() and boost::end() at one central point
of the program is much easier than writing a wrapper for every such
container and use that everywhere where boost.range is used in
conjunction with the container.

> b) I don't find any mention of boost::begin() anywhere in the table
> of contents of the documentation. I guess it might be implemented
> somewhere for some types like stl containers
> (extending the library Method 1: refers to begin() member
> functions of a user type to be supported - but that would be
> a different thing)
The default implementation of begin(v) is just "return v.begin();" so
it is not a different thing.

Greetings,
Oswin


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