c++ - How to switch to typedef from template aliasing? -
i have template class implements registry design pattern. values registered keys , stored in container:
template <typename key, typename value, template <typename...> class container > class registry { public: typedef key key_type; typedef value value_type; typedef std::pair<key_type, value_type> element_type; typedef container<element_type> container_type; then, can use sequence containers this:
registry<const char*,void*, std::list> r1; registry<const char*,void*, std::vector> r2; i can use alias:
template <typename t> using alias_container = std::array<t, 10>; registry<const char*,void*, alias_container > r4; but can't figure out how use typedef this:
template <typename t> class my_container2 { typedef std::array<t,3> type; }; i want this:
registry<const char*,void*, my_container2::type > r5; thanks lot help.
type dependent on template type provided my_container2. in order use need specify template parameter like
registry<const char*,void*, my_container2<some_type>::type > r4; ^^^^^^^^^ template type here this same concept iterators standard types. can't use container_type::iterator. have use container_type<some_type>::iterator.
Comments
Post a Comment