Topic: Could we use T:X to abbreviate "typename T::X"? (and get cleaner code)


Author: Walter Mascarenhas<walter.mascarenhas@googlemail.com>
Date: Tue, 22 Jan 2013 10:54:51 CST
Raw View
When I use constructs like std::enable_if my code gets polluted with many typenames, as in

typename std::enable_if<  std::is_same<typename A::X, typename B::Y>::value,
                         typename C::Z>::type

Would it be too costly to introduce a symbol, say ':', in the language so
that "T:X" is an abbreviation for "typename T::X"?

This would lead to this cleaner version of the line above:

std::enable_if<  std::is_same<A:X, B:Y>::value, C:Z>::type

I also dream of writing this in the even simpler form

std::enable_if<  std::is_same<A:X, B:Y>, C:Z>  (meaning C:Z when A:X = B:Y)

but I guess this would be too much to ask for.





--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]