C++11 - friend with a template alias
Hi, I want to declare alias template as a friend of class. I've tried
following constructions, that work for classes:
-- start --
#include <vector>
template <typename T>
using my_type = std::vector<T>;
class X {
// MSVC 2013 : error C2955: 'my_type' : use of alias template
// requires template argument list
// GCC 4.8.3 : invalid use of template-name 'my_type' without
// an argument list
template <typename> friend my_type;
// MSVC 2013 : error C2988: unrecognizable template declaration/definition
// GCC 4.8.3 : expected unqualified-id before ';' token
template <typename T> friend my_type<T>;
// MSVC 2013 : error C2920: redefinition : 'my_type' : class template has
// already been declared as 'using my_type = std::vector<T,std::allocator<_Ty>>'
// GCC 4.8.3 : declaration of template 'template<class T> struct my_type'
// conflicts with previous declaration 'template<class T>
// using my_type = std::vector<T>'
template <typename T> friend class my_type;
};
-- end --
Aliases aren't mentioned in the section about friends, standard merely says
(section 11.3, paragraph 3):
A friend declaration that does not declare a function shall have one of
the following forms:
friend elaborated-type-specifier ;
friend simple-type-specifier ;
friend typename-specifier ;
What is a valid syntax? Or, maybe it's not possible?
TIA
w.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]