c++ - How do I typedef base class's member template? -


i'm trying make short form of rebind_alloc member template.

the minimal part of code below:

template <class t, class allocator = std::allocator<t> > struct {   using allocator_type = allocator;    template <class u>   using rebind_alloc = typename std::allocator_traits<allocator>::template rebind_alloc<u>; };  template <class t, class allocator = std::allocator<t> > struct b : a<t, allocator> {   using base = a<t>;   using typename base::allocator_type;    b(const allocator_type& alloc);   // b(const base::allocator_type& alloc);    template <class u>   using typename base::rebind_alloc<u>; // error on line }; 

the reason wrote every base class's member type in class template inheriting class template cannot directly use member type use base::some_type form.

a single type allocator_type okay, got error when try use using statements member template.

how use it?

there ten errors in code. spot difference. (missing semicolons count one.)

#include <memory>  template <class t, class allocator = std::allocator<t> > struct {   using allocator_type = allocator;    template <class u>   using rebind_alloc =       typename std::allocator_traits<allocator>::template rebind_alloc<u>; };  template <class t, class allocator = std::allocator<t> > struct b : a<t, allocator> {   using base = a<t, allocator>;   using allocator_type = typename base::allocator_type;    b(const allocator_type& alloc);    template <class u>   using rebind_alloc = typename base::template rebind_alloc<u>; }; 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -