Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] questions about documentation and usage
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-11-04 23:34:04


>>> Is the documentation under [1] and/or [2] unclear?
>>
>> It is.
>>
>> Method 1 provides information I would have expected to find
>> in the SinglePassRange concept. I'm assuming that the member
>> functions and types would be members of any class modeling
>> SinglePassRange. I say "assuming becaus it doesn't actually
>> say that.
>>
>> Then...why are you assuming that?
>
> Because the documentation says they are member functions
> but it doesn't say of what type. One has no choice to guess
> or assume.

I re-read this. Turns out it DOES say that that the member functions
correspond to an instance of a type which models SinglePassRange.
So my assumption was correct - though unnecessary.

>> This is also how
>> Boost.Fusion and Boost.MPL (at least) are structured, AFAIK.
>
> I don't think that's accurate. If you want to make your own model
> of a concept, you just make sure your types implement all the valid
> expressions.
>
>
> Maybe in your world. And maybe your world is the correct one. But
> compare Boost.Fusion's Forward Sequence concept documentation [6]
> with its extension mechanism documentation [7];

Damn - I didn't realze the fusion had an extention mechanism for Sequence.
I don't know if this is necessary or some sort of convenience to help
creators "get it right". Previously I made new algorithms just by
implementing the relevant concept.

>> I'm sorry, I'm still not following. Can you be more concrete? I don't
>> know what you mean by building a library "concurrently with the
>> documentation", and I'm not sure what your suggestion about "how to
>> go about these things" actually is.
>
> rsd.com/blincubator.com/advice/
>
>
> page not found

Lost a character - rrsd.com/blincubator.com/advice/

>> #include <boost/concept/assert.hpp>
>> #include <boost/range/algorithm/find.hpp>
>> #include <boost/range/concepts.hpp>
>>
>> struct X { };
>>
>> namespace boost
>> {
>> int const * begin(X&);
>> int const * end(X&);
>> } // namespace boost
>>
>> int main(int argc, char* argv[])
>> {
>> X x;
>> //boost::find(x, 0); // compiler error
>> boost::range::find(x, 0); // compiler error
>> return 0;
>> }
>> --------
>>
>> Same error comes up as in a BOOST_CONCEPT_ASSERT, pointing to a line
>> referencing range_const_iterator and range_mutable_iterator,
>> suggesting that Boost.Range cannot associate an iterator type with X.

I compiled this example on both MSVC 9.0 and GCC 4.5.3

Failed to compile on MSVC
Compiled with no error on GCC.

BTW - my view is that it SHOULD compile without error since
struct X fullfills the requirements of the SinglePassConcept as written
in the documentation.

I think my original question was motivated by the fact that it didn't
compile with my MSVC system. Of course I forget now.

Robert Ramey



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