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


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

Re: std::bind with member functions and C++20

From Cholo Lennon <chololennon@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: std::bind with member functions and C++20
Date 2021-04-27 00:46 -0300
Organization Aioe.org NNTP Server
Message-ID <s681du$1u5q$1@gioia.aioe.org> (permalink)
References (7 earlier) <s5u2ri$1eti$1@gioia.aioe.org> <s5v29s$t5k$1@gioia.aioe.org> <s6418a$1266$1@gioia.aioe.org> <s67m7v$4ft$1@gioia.aioe.org> <s680l3$2nj$1@dont-email.me>

Show all headers | View raw


On 4/27/21 12:32 AM, Bonita Montero wrote:
>>         // For simplicity, callbacks are reused for similar widgets
>>         name.onFocus = std::bind(&MyWindows::onFocus, this, _1);
>>         name.onLostFocus = std::bind(&MyWindows::onLostFocus, this, _1);
>>         address.onFocus = std::bind(&MyWindows::onFocus, this, _1);
>>         address.onLostFocus = std::bind(&MyWindows::onLostFocus, this, 
>> _1);
> 
> You would never use bind()-objects themselfes as callback-types because
> the types are variable depending on the parameters. Usually you would
> encapsulate them into a function-object which gives you the advantage,
> that you can have any types of paramters with them, f.e.:
>           name.onFocus = function<void(param_type)>( bind( 
> &MyWindows::onFocus, this, _1 ) );

But for my previous post it should be clear that onFocus/onLostFocus/etc 
are declared as std::function. For the sake of simplicity I didn't add 
the declaration/definition of these properties (because they belong to 
classes, Button and Editbox, whose code I didn't show)

--
Cholo Lennon
Bs.As.
ARG

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


Thread

std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-19 11:23 +0200
  Re: std::bind with member functions and C++20 MrSpook_78@xvdv0t9masednkplrcjyxfsl.tv - 2021-04-19 09:32 +0000
    Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-19 13:04 +0200
      Re: std::bind with member functions and C++20 Öö Tiib <ootiib@hot.ee> - 2021-04-21 23:59 -0700
        Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-22 10:06 +0200
          Re: std::bind with member functions and C++20 Melzzzzz <Melzzzzz@zzzzz.com> - 2021-04-22 08:14 +0000
            Re: std::bind with member functions and C++20 "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-04-22 01:20 -0700
            Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-22 11:32 +0200
      Re: std::bind with member functions and C++20 Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-04-22 07:12 -0700
        Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-22 17:50 +0200
          Re: std::bind with member functions and C++20 MrSpook_tm0@i9d.com - 2021-04-22 16:25 +0000
            Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-22 19:02 +0200
              Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-22 19:25 +0200
            Re: std::bind with member functions and C++20 Cholo Lennon <chololennon@hotmail.com> - 2021-04-22 14:16 -0300
              Re: std::bind with member functions and C++20 MrSpook_wqqeppl@_nb0l03nl53p.tv - 2021-04-23 09:09 +0000
                Re: std::bind with member functions and C++20 Cholo Lennon <chololennon@hotmail.com> - 2021-04-23 15:05 -0300
                Re: std::bind with member functions and C++20 Cholo Lennon <chololennon@hotmail.com> - 2021-04-23 15:47 -0300
                Re: std::bind with member functions and C++20 MrSpook_Xh_gU9dm@pdj82ouz7mi_c.gov.uk - 2021-04-25 15:18 +0000
                Re: std::bind with member functions and C++20 Öö Tiib <ootiib@hot.ee> - 2021-04-25 10:07 -0700
                Re: std::bind with member functions and C++20 MrSpook_2p4eH@0kd0c4bkwzno.biz - 2021-04-26 07:40 +0000
                Re: std::bind with member functions and C++20 Cholo Lennon <chololennon@hotmail.com> - 2021-04-26 21:35 -0300
                Re: std::bind with member functions and C++20 Bonita Montero <Bonita.Montero@gmail.com> - 2021-04-27 05:32 +0200
                Re: std::bind with member functions and C++20 Cholo Lennon <chololennon@hotmail.com> - 2021-04-27 00:46 -0300
                Re: std::bind with member functions and C++20 MrSpook_1xajf_a1kl@f5mda.co.uk - 2021-04-27 07:37 +0000
            Re: std::bind with member functions and C++20 Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-04-22 10:35 -0700
  Re: std::bind with member functions and C++20 Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-04-22 07:11 -0700

csiph-web