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


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

Re: Should we have a core language operator for forwarding arguments?

From Miles Bader <miles@gnu.org>
Newsgroups comp.std.c++
Subject Re: Should we have a core language operator for forwarding arguments?
Date 2011-11-12 11:33 -0800
Organization unknown
Message-ID <877h36qpkt.fsf@catnip.gol.com> (permalink)
References <c9357619-0e59-4e69-bcb7-ba245dd10d5a@h12g2000vbf.googlegroups.com> <433e4713-b73e-42ad-9f5b-e2284fd27cc7@y42g2000yqh.googlegroups.com> <01a66a1b-c21f-4fb6-9650-8ea5296a5914@r9g2000vbw.googlegroups.com>

Show all headers | View raw


Nikolay Ivchenkov<tsoae@mail.ru> writes:
> Currently we can easily implement forwarding without any library
> components:
>
>      template<class T>
>          void f(T&&t)
>              { g(static_cast<T&&>(t)); }
>
> And in fact, std::forward (where it is applicable) does not have
> significant advantages over plain static_cast operator.

Sure it does:  it expresses intent, which makes user code easier to
understand.

Names are a good thing.  :)

Sure the extra verbosity can be annoying or even make code less
readable for operations which are very common (e.g. "+" vs. "plus"),
but I find it hard to believe std::forward falls into that category...

-Miles

--
"Whatever you do will be insignificant, but it is very important that
 you do it."  Mahatma Gandhi


[ 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

Should we have a core language operator for forwarding arguments? Nikolay Ivchenkov <tsoae@mail.ru> - 2011-11-09 19:10 -0600
  Re: Should we have a core language operator for forwarding arguments? Daniel Krügler<daniel.kruegler@googlemail.com> - 2011-11-10 07:58 -0800
  Re: Should we have a core language operator for forwarding arguments? Arne Mertz<arnemertz@googlemail.com> - 2011-11-10 10:41 -0800
    Re: Should we have a core language operator for forwarding arguments? Nikolay Ivchenkov<tsoae@mail.ru> - 2011-11-11 13:04 -0800
      Re: Should we have a core language operator for forwarding arguments? Miles Bader <miles@gnu.org> - 2011-11-12 11:33 -0800
        Re: Should we have a core language operator for forwarding arguments? Nikolay Ivchenkov<tsoae@mail.ru> - 2011-11-12 21:46 -0800

csiph-web