lundi 20 avril 2015

c++ template using declaration from base class [duplicate]

This question already has an answer here:

Why does the following code not work (using VS2013)?

class Test1
{
public:
  template<typename T>
  using my_type = T;
};

template<typename T, typename V>
class My : public T
{
public:
  using t_type = T;
  using my_type2 = t_type::my_type<V>;
};

int main()
{
  const My<Test1, double>::my_type2 x = 5.5;

  return 0;
}

Test1::my_type would have a more complex type. My would be a policy based class where Test1 would be one of the policies. my_type2 should become a specific type based on the policy. And Test1 can't be a template directly taking the type of V. Thanks.

Aucun commentaire:

Enregistrer un commentaire