Groups | Search | Server Info | Login | Register


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

Lamda as Operator Overload

Message-ID <4a4746a5-3ef6-4cfe-90d1-d1e715e7e92b@googlegroups.com> (permalink)
Newsgroups comp.lang.c++.moderated
From Adi Shavit <adishavit@googlemail.com>
Subject Lamda as Operator Overload
Organization unknown
Date 2016-04-27 06:46 -0600

Show all headers | View raw


{ edited by mod to shorten lines to ~70 characters. -mod }

Hi,

  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.

Thanks!
Adi


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