Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: TypeErasure (docs, Concept Maps misnamed?)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-06-21 22:32:28


AMDG

On 06/21/2012 06:00 PM, Larry Evans wrote:
> On 06/21/12 13:17, Steven Watanabe wrote:
>> AMDG
>>
>> On 06/21/2012 10:34 AM, Larry Evans wrote:
>>>
>>> The page:
>>> */libs/type_erasure/doc/html/boost_typeerasure/conceptdef.html
>>> uses the term 'primitive concept':
>>>
>>> A primitive concept must be a specialization of a class template,
>>> with a static member function called apply.
>>>
>>> What's the difference between a 'Concept Map' and 'primitive concept'?
>>> If they are the same, why not use the same term for both?
>>> [snip]
>>>
>>
>> They aren't the same. A primitive
>> concept specified the interface and
>> (optionally) a default Concept Map.
>> A Concept Map specifies how a specific
>> type models the concept.
>>
>
> Would not:
>
> template<class T = _self, class U = T>
> struct less_than_comparable
> {
> static bool apply(const T& lhs, const U& rhs) { return lhs < rhs; }
> };
>
> from:
>
>
> http://svn.boost.org/svn/boost/sandbox/type_erasure/boost/type_erasure/operators.hpp
>
> satisfy the definition you give above for a primitive concept:
>
> A primitive concept specified the interface and
> (optionally) a default Concept Map.
>
> Where the optional default Concept Map is the general template, as
> shown in the above operator.hpp. Somehow, I assume by "specified the
> interface" you mean, somehow, the specialization idea:
>
> A primitive concept must be a specialization of a class template,
> with a static member function called apply.
>
> from:
>
> */libs/type_erasure/doc/html/boost_typeerasure/conceptdef.html
>
> IOW, an example of "specified the interface" would be the
> specialization of less_than_comparable,
> less_than_comparable<std::type_info>
> shown here:
>
>
> */libs/type_erasure/doc/html/boost_typeerasure/concept.html#boost_typeerasure.concept.concept_map
>
> Of course, I could be completely wrong; hence, could you be more
> specific about what you mean by "specified the interface" and
> "(optionally) a default Concept Map"?
>
> I can't help but draw the conclusion that a "Concept Map" is simply
> the general template and all specializations of a:
>
> class template, with a static member function called apply
>
> as mentioned in conceptdef.html; however, I also feel that's way too
> simple. What am I missing?
>

You're making this way more complex than
it needs to be. The section called
"Concept Maps" is part of the tutorial
and explains how to implement something
that corresponds to a concept_map in the
C++ standard concept proposals. I'm
not using the term "Concept Map" in any
formal way. conceptdef.html on the other
hand is my attempt to define the requirements
/precisely/. As such it necessarily includes
a lot of things that are discussed in a
less formal (and more approachable) way,
elsewhere.

In Christ,
Steven Watanabe


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