c++ - C++11, using vs typedef, templatized -
instead of
typedef struct { double x,y; } point;
c++11 supports
using point = struct {double x, y;};
unfortunately, approach not work type t
template <typename t> using point = struct {t x, y;};
is there way of resolving problem?
using point = ...;
type alias (formally called 'alias'). i.e., it's different syntax typedef
type involved named in ...
.
template<typename t> using point = ...;
alias template, type involved again named in ...
.
what both aliases , alias templates have in common both must refer type-id (c++11 [basic.scope.pdecl]p3). type-ids must in turn name types. (go figure.)
the problem template<typename t> struct {t x, y;}
not type, class template, , established alias templates must refer types. changing code resolve your problem, i've no idea haven't said is... ;-] regarding that, please see what xy problem?
Comments
Post a Comment