Groups | Search | Server Info | Login | Register


Groups > comp.lang.c++.moderated > #7434

Re: Lamda as Operator Overload

Message-ID <3a70b675-598a-490d-8383-6d0462fa9f1a@googlegroups.com> (permalink)
Newsgroups comp.lang.c++.moderated
From Martin Bonner <martinfrompi@yahoo.co.uk>
Subject Re: Lamda as Operator Overload
Organization unknown
References <4a4746a5-3ef6-4cfe-90d1-d1e715e7e92b@googlegroups.com>
Date 2016-04-27 08:44 -0600

Show all headers | View raw


On Wednesday, 27 April 2016 13:50:10 UTC+2, Adi Shavit  wrote:
> Is it possible to create a lambda that behaves like an operator
> overload? 
> That is, instead of calling it with the operator() syntax, it will be
> called by some other, e.g. binary, infix operator.
> 
> Is it possible to generically simulate this somehow just like lambdas
> can as structs overloading the () operator. The problem is just how to
> get the compiler/ADL to call the correct function based on the operator.

I don't see how.  The point about a lambda is that it creates a thing
without a name (that you can then store in a named variable, but the thing
itself is nameless), whereas operator overloading works precisely on the
basis of the name of the (member)function.


-- 
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

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


Thread

Lamda as Operator Overload Adi Shavit <adishavit@googlemail.com> - 2016-04-27 06:46 -0600
  Re: Lamda as Operator Overload Öö Tiib <ootiib@hot.ee> - 2016-04-27 08:44 -0600
    Re: Lamda as Operator Overload Kalle Olavi Niemitalo <kon@iki.fi> - 2016-04-27 15:21 -0600
      Re: Lamda as Operator Overload Adi Shavit <adishavit@googlemail.com> - 2016-04-27 17:13 -0600
        Re: Lamda as Operator Overload Öö Tiib <ootiib@hot.ee> - 2016-04-28 06:30 -0600
  Re: Lamda as Operator Overload Martin Bonner <martinfrompi@yahoo.co.uk> - 2016-04-27 08:44 -0600
    Re: Lamda as Operator Overload Adi Shavit <adishavit@googlemail.com> - 2016-04-27 15:14 -0600

csiph-web