|
Boost : |
Subject: Re: [boost] [contract] concepts: pseudo-signatures vs. usage patterns
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-10-14 04:40:16
On Sat, Oct 13, 2012 at 10:33 PM, Matt Calabrese <rivorus_at_[hidden]> wrote:
> On Sat, Oct 13, 2012 at 9:38 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]>wrote:
>
>>
>> Because I don't know how to support the following:
>>
>> template( typename(ObjectType) T, typename(MapType<T>) U )
>> concept_map (RandomAccessIterator) ( T* )
>>
>> Where U is of constrained by MapType<U, T>. The only way I can think
>> to do this is typename(MapType<mpl::_, T>) U (then it'd be up to
>> Boost.Generic to deal with mpl::_ used this way). Does this use case
>> apply to associated types?
>>
>
> This applies to using "auto" in the parameter list in N2914. While I don't
> support it yet, I was planning on doing it via the preprocessor rather than
> trying to do it with template metaprogramming,
This is also better because the pp parser can get all the "traits" of
the declaration (instead than leaving the substitution of auto/mpl::_
to the back-end). This way different back-ends can do different things
with the parsed pp "traits".
> though I haven't thought
> about it in depth yet:
>
> template( ((ObjectType)) T, (((MapType)( auto, T )) U)
It will have to be something like that, maybe with typename to
distinguish from value template parameters as I mentioned before:
template( typename(ObjectType) T, typename(MapType)(auto, T) U ) // (1)
...
Or, as I was saying, can't we just require the use of requires ;) instead:
template( typename T, typename U )
requires( ObjectType<T>, (MapType<U, T>) ) // (2)
...
Does Boost.Generic need ObjectType and MapType separately (as per 1)
or it can use their instantiations Object<T> and MapType<U, T> (as per
2)?
> This corresponds to the N2914 syntax mentioned in [temp.param] on page 312
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2914.pdf
--Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk