Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2007-10-05 04:25:21


I am adding typeof emulation support for Borland, but have some
trouble of adding template template support for Borland 5.9.2. (This
problem was not present in Borland 5.8.2)
The problem can be reduced to the following:
template<class T, class U>
struct t0;

template<class T, int n>
struct t1;

template<template<class, class> class T, template<class, int> class U>
struct t2;

    struct non_template_works_ok {
        template< class T0 , class T1 > struct decode_params;
        template< template <class, class > class T0 , template <class,
int > class T1 >
        struct decode_params< T0< int , int > , T1< int , (int )0 > > {
            typedef t2<T0, T1> type;
        };
    };

    template<std::size_t value>
    struct template_specialization_worked_in_borland_5_8_2;
    template<>
    struct template_specialization_worked_in_borland_5_8_2<1>
    {
        template< class T0 , class T1 > struct decode_params;
        template< template <class, class > class T0 , template <class,
int > class T1 >
        struct decode_params< T0< int , int > , T1< int , (int )0 > > {
            typedef t2<T0, T1> type;
        };
    };
    template<typename T0,typename T1>
    struct tester {
        typedef typename
non_template_works_ok::decode_params<T0,T1>::type type_ok;
        typedef typename
template_specialization_worked_in_borland_5_8_2<1>::decode_params<T0,T1>::type
type_fails;
    };
    tester<t0<int,int>,t1<int,0> > a;

Is there a workaround for this? In order to use the non-template
version, each BOOST_TYPEOF_REGISTER_TEMPLATE would have to come up
with a unique class name to be used for the decoding purpose.

Regards
Peder


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