Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #586

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

From Walter Mascarenhas<walter.mascarenhas@googlemail.com>
Newsgroups comp.std.c++
Subject Re: Could we use T:X to abbreviate "typename T::X"? (and get cleaner code)
Date 2013-01-24 15:15 -0800
Organization unknown
Message-ID <92a59a4e-4c63-44dd-8205-9c030d578515@googlegroups.com> (permalink)
References <88b1e391-5730-4a5e-98f7-8af19543ba1a@googlegroups.com> <kdmlij$dm5$1@dont-email.me>

Show all headers | View raw


On Tuesday, January 22, 2013 9:26:32 PM UTC-2, Daniel Krügler wrote:
>  Am 22.01.2013 17:54, schrieb Walter Mascarenhas:
>
>
>  >  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"?
>
>
>  An alternative solution without need of any further language
>  extensions is the usage of a template alias instead. Typical examples
>  are:
>
>  template<bool C, class T = void>
>  using EnableIf = typename std::enable_if<C, T>::type;
>
>
>  HTH&  Greetings from Bremen,
>
>
>
>  Daniel Krügler
>


Thanks for the reply. This is indeed a
good alternative for people with good
compilers.

Unfortunately I am stuck with Visual C++
and won't be able to apply this solution
for a while. Of course microsoft is the
one to blame here and people in this
list shouldn't worry about this question.

Greetings from Brazil,

         walter.




>
>
>  --
>
>  [ 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                      ]


-- 
[ 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                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Could we use T:X to abbreviate "typename T::X"? (and get cleaner code) Walter Mascarenhas<walter.mascarenhas@googlemail.com> - 2013-01-22 10:54 -0600
  Re: Could we use T:X to abbreviate "typename T::X"? (and get cleaner code) Daniel Krügler <daniel.kruegler@googlemail.com> - 2013-01-22 15:26 -0800
    Re: Could we use T:X to abbreviate "typename T::X"? (and get cleaner code) Walter Mascarenhas<walter.mascarenhas@googlemail.com> - 2013-01-24 15:15 -0800
    Re: Could we use T:X to abbreviate "typename T::X"? (and get cleaner code) SG<s.gesemann@googlemail.com> - 2013-02-27 09:05 -0800
      Re: Could we use T:X to abbreviate "typename T::X"? (and get cleaner code) Daniel Krügler <daniel.kruegler@googlemail.com> - 2013-02-27 10:52 -0800

csiph-web