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


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

Re: Lambda in STL compare

From Muttley@DastartdlyHQ.org
Newsgroups comp.lang.c++
Subject Re: Lambda in STL compare
Date 2024-10-07 14:06 +0000
Organization A noiseless patient Spider
Message-ID <ve0pth$1o7qa$1@dont-email.me> (permalink)
References <ve02pi$1kp91$1@dont-email.me> <cone.1728300934.54102.174348.1000@ripper.email-scan.com>

Show all headers | View raw


On Mon, 07 Oct 2024 07:35:34 -0400
Sam <sam@email-scan.com> boring babbled:
>Muttley@DastartdlyHQ.org writes:
>
>> which is no simpler than just using a functor, why can't we just do:
>>
>> map<string,int,[](const string &s1, const string &s2)
>> {
>>         return strcasecmp(s1.c_str(),s2.c_str()) < 0;
>> }) m;
>>
>> I'm sure updating the compilers so a lambda could be a template parameter
>> wouldn't be beyond the wit of man.
>
>The reason we cannot do that is because the third parameter to std::map is a  
>type, and not an object. A lambda expression is an instance of an anonymous  
>type, and not a type in of itself.

Its a definition, not a value, so why can't it silently be converted internally
by the compiler? Presumably it does just that when it sees decltype anyway.

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


Thread

Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-07 07:32 +0000
  Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-07 10:12 +0200
    Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-07 09:32 +0000
  Re: Lambda in STL compare David Brown <david.brown@hesbynett.no> - 2024-10-07 10:16 +0200
  Re: Lambda in STL compare Sam <sam@email-scan.com> - 2024-10-07 07:35 -0400
    Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-07 14:06 +0000
      Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-07 16:13 +0200
        Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-07 14:53 +0000
          Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-07 17:06 +0200
            Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-07 15:46 +0000
              Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-07 17:55 +0200
                Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-08 08:23 +0000
                Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-08 10:25 +0200
                Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-08 10:24 +0000
                Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-08 13:10 +0200
      Re: Lambda in STL compare Sam <sam@email-scan.com> - 2024-10-08 08:25 -0400
        Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-08 14:44 +0000
          Re: Lambda in STL compare Sam <sam@email-scan.com> - 2024-10-08 17:52 -0400
            Re: Lambda in STL compare "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-10-08 22:56 -0700
            Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-09 07:15 +0000
              Re: Lambda in STL compare Bonita Montero <Bonita.Montero@gmail.com> - 2024-10-09 09:21 +0200
                Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-09 07:22 +0000
            Re: Lambda in STL compare Muttley@DastartdlyHQ.org - 2024-10-09 07:16 +0000
              Re: Lambda in STL compare "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-10-09 00:23 -0700
  Re: Lambda in STL compare Andrey Tarasevich <andreytarasevich@hotmail.com> - 2024-10-07 07:17 -0700

csiph-web