c++ - Why can't I pass a type member of a class as a template parameter? -
i unable pass type member of class template parameter. example in following piece of code :
std::array<int, 1> a; std::array<typename a::value_type, 1> a2;
won't compile.
what reason ? there workaround?
a
not type, hence can't apply ::
it. can use decltype
retrieve a
's type :
std::array<int, 1> a; std::array<decltype(a)::value_type, 1> a2;
Comments
Post a Comment