vendredi 21 avril 2017

Policy class with template alias

I am not sure whether the question title is right.

I am looking for a method to choose one of the template specializations of class A based on template alias from policy class. Is there any way to achieve this ?

// g++ -Wall -std=c++11 p.cpp 

template <class T>
class StorageCPU
{
    T * ptr ;
} ;

class PolicyCPU
{
    public:
        template <class T>
        using Storage = StorageCPU <T> ;
        // Many other settings...
} ;


template <template <class> class Storage>
class A ;


template <>
class A <StorageCPU>
{ } ;

int main ()
{
    A <StorageCPU> a1 ;
    A <PolicyCPU::Storage> a2 ; // <--- this one fails

    return 0 ;
}

Aucun commentaire:

Enregistrer un commentaire