1

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 ;
}
max66
  • 65,235
  • 10
  • 71
  • 111
tadtm
  • 53
  • 6
  • 1
    Ok... another compiler vs compiler vs standard.. `gcc` compiles this without a problem. `clang` doesn't ... – bolov Apr 21 '17 at 12:54
  • do you really need the `template template`? Can you refactor it to a regular class? – bolov Apr 21 '17 at 12:56
  • I think it must be template template, this is universal replacement for std::vector, which works for different machines (CPU/GPU/different access methods). But the problem may be in gcc version - I am using 4.7.3 due to old CUDA. I will try more recent g++, thank you for hint :)) – tadtm Apr 21 '17 at 13:04

0 Answers0