Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-01-26 07:13:39


Arkadiy Vertleyb wrote:
> template<class T, class Pred = std::less<T>, class A = std::allocator<T> >
> class set;
>
> BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 1) // error
> BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 2) // error
> BOOST_TYPEOF_REGISTER_TEMPLATE(std::set, 3) // OK
>

Would it be possible to allow Typeof registration of partially specialized
templates?

Ideally, this feature would allow us to

a) register the templates partially specialized with their default template
arguments (and solve the problem described above)

     REGISTER_SPEC((typename T),
         (std::set< T )( std::less<T> )( std::allocator<T> > ))

     REGISTER_SPEC((typename T)(typename Pred),
         (std::set< T )( Pred )( std::allocator<T> > ))

     // ^^^ NOTE: not a proposal for an interface -- for illustration, only

,

b) exploit redundancy to eliminate the integers needed to encode the type

     REGISTER_SPEC((typename T), (std::pair< T )( T ))

     // for complex to encode types, we reduce the complexity for about 50%

, and

c) register templated composite types of expression common to an expression
template framework. E.g.

     REGISTER_SPEC((class P1)(class P2)(typename A),
         (spirit::sequence<
             spirit::action<spirit::difference<P1 )( P2> )( A> )( P2> )

     // for Spirit expressions of the following kind:
     //
     // (parser1 - parser2)[action] >> parser2

Regards,

Tobias


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