
Oswin Krause wrote:
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.
actually what would have occurred to me would have been to just use X.begin() ... which containers already have. Other cases would be handled by a free standing function - similar to the way it does now I beleive.
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.
I don't want this thread to pivot to the design of boost.range itself. That would require I spend a lot more time. My original observation was that it was no possible to use the library from a plain reading of the documentation - that it was confusing and misleading. I'd like to stick to the topic if we can. Robert Ramey