c++ - How to work around `using K = ...` in MSVC 2012? -
c++ - How to work around `using K = ...` in MSVC 2012? -
it appears msvc 2012 doesn't back upwards using k = ...;
-type declarations. example, code:
template <class map> inline void foo(map &m) { using k = typename map::key_type; using v = typename map::mapped_type; // ... }
the result syntax error:
error c2143: syntax error : missing ';' before '=' error c2873: 'k' : symbol cannot used in using-declaration
how can work around missing feature of msvc 2012, without upgrading compiler?
microsoft's back upwards c++11 incomplete, , 1 of things that's missing in vs2012. in case, should able utilize old-fashioned typedef; e.g.:
typedef typename map::key_type k;
the place workaround falls apart when type templated:
template<typename t> using bar = foo<t>; // ok if compiler supports template<typename t> typedef foo<t> bar; // doesn't compile
but still @ to the lowest degree have option:
template<typename t> struct bar { typedef foo<t> type; };
c++ templates visual-studio-2012 c++11 types
Comments
Post a Comment