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


Groups > comp.lang.c++ > #11061

Re: C++11 lambdas

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Miles Bader <miles@gnu.org>
Newsgroups comp.lang.c++
Subject Re: C++11 lambdas
Date Mon, 24 Oct 2011 17:27:30 +0900
Organization NEC Electronics
Lines 28
Message-ID <buovcrekd59.fsf@dhlpc061.dev.necel.com> (permalink)
References <835cd0b9-b3e1-4aa2-bf61-f71760b8fb04@fi7g2000vbb.googlegroups.com> <19244099.1201.1317791064110.JavaMail.geo-discussion-forums@prng5> <c0b071ac-c330-4aa2-89d1-707ddabd1b13@h23g2000pra.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
X-Trace individual.net fza5Pjfsbq0oPI7CcatypgowVsiC+hipULvhoSBtFqWpQtZhrk
Cancel-Lock sha1:M65R0BUf+L+1daV/QFLy76vY2Rs= sha1:/i7lxZIpMHSJop0c0PcBkPmVvVA=
System-Type x86_64-unknown-linux-gnu
Blat Foop
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:11061

Show key headers only | View raw


Jerry <jerry.jeremiah@gmail.com> writes:
>> lambdas was a function that compiler do it for you, so you
>> cannot declare a function that have a "auto" type argument
>>
>> void (auto pair) { ... }
>>
>> I think compiler cannot work!
>
> Yes, I would never have considered doing this with a free
> function because its obvious that the compiler wouldn't know.
> And yet in the lambda it seemed to be such a good idea even
> thought it obviously the same exact thing.

In the case of a named function, "void fun (auto x) { ... }"
would basically be a more natural syntax for
"template<typename T> void fun (T x) { ... }"

It's discussed here:

http://channel9.msdn.com/Shows/Going+Deep/Herb-Sutter-C-Questions-and-Answers

[Summary: both were considered and came close to getting in the
standard, but didn't go in for practical reasons.]

-Miles

-- 
Erudition, n. Dust shaken out of a book into an empty skull.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

C++11 lambdas Jerry <jerry.jeremiah@gmail.com> - 2011-09-19 15:40 -0700
  Re: C++11 lambdas Lucien Coffe <lcof@nospam.invalid> - 2011-09-20 06:38 +0000
  Re: C++11 lambdas Juha Nieminen <nospam@thanks.invalid> - 2011-09-20 06:41 +0000
    Re: C++11 lambdas Miles Bader <miles@gnu.org> - 2011-09-20 16:57 +0900
    Re: C++11 lambdas Noah Roberts <roberts.noah@gmail.com> - 2011-09-20 08:23 -0700
      Re: C++11 lambdas Juha Nieminen <nospam@thanks.invalid> - 2011-09-21 07:14 +0000
        Re: C++11 lambdas Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-21 18:25 -0400
  Re: C++11 lambdas ChuanQi Tan <chuanqi.tan@gmail.com> - 2011-10-04 22:04 -0700
    Re: C++11 lambdas Jerry <jerry.jeremiah@gmail.com> - 2011-10-23 15:21 -0700
      Re: C++11 lambdas Miles Bader <miles@gnu.org> - 2011-10-24 17:27 +0900

csiph-web