Boost logo

Boost :

Subject: Re: [boost] Provisional Boost.Generic and Boost.Auto_Function (concepts without concepts)
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2010-12-15 20:02:51


On Wed, Dec 15, 2010 at 6:48 PM, Dave Abrahams <dave_at_[hidden]> wrote:

> I think from a usability perspective it's problematic, and could
> impair adoption, but I see nothing wrong with using it as a
> stepping-stone.

That was what I thought at first as well, but the more I think about it the
less this actually seems to be a problem. First, because of the potential
restricted "auto concept maps" I mentioned in an earlier post that would be
able to create many of these concept maps automatically (I.E. going back to
my example, if someone makes a random access iterator type and uses the
Boost.Operators helper base, all of the concept maps would be generated
automatically anyway), and second, since many concept maps are empty, it
would be trivial to create a macro that combines a bunch of empty concept
maps together.

For instance, I could very easily make a utility macro called
"BOOST_GENERIC_CONCEPT_MAP_SEQ" that could be used as such:

//////////
// The creator of RandomAccessIterator (in this case me) would provide this
// convenience macro that internally uses BOOST_GENERIC_CONCEPT_MAP_SEQ
#define BOOST_GENERIC_RANDOM_ACCESS_ITERATOR_MAP( ... )\
BOOST_GENERIC_CONCEPT_MAP_SEQ\
( (Iterator)(InputIterator)(ForwardIterator)(BidirectionalIterator)(RandomAccessIterator)\
, __VA_ARGS__\
)
//////////

Then, someone who wants to create a RandomAccessIterator just does something
along the lines of:

//////////
BOOST_GENERIC_RANDOM_ACCESS_ITERATOR_MAP
( ( template ( (class) Some, (class) Template, (class) Parameters ) )
, ( (user_defined_iterator_template< Some, Template, Parameters >) )
)
//////////

The above would automatically create all of the empty concept maps necessary
for RandomAccessIterator and isn't really any more complicated for the
creator of the iterator type.

Still, yes, ideally this would just be a stepping stone, but it's certainly
usable.

-- 
-Matt Calabrese

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