[Cs3] binding member functions and constructors

Mikhail Nesterenko mnestere at kent.edu
Tue Mar 4 20:19:39 EST 2025


CS3 students,

first is allowed, second is not

Here is a c++ reference with an example of a (structure) member
function being bound

	 https://en.cppreference.com/w/cpp/utility/functional/bind

The syntax is

    auto f3 = std::bind(&Foo::print_sum, &foo, 95, _1);

Where Foo is the name of the structure.

Here is a stack overflow answer as to why a constructor cannot be used
with bind:

   https://stackoverflow.com/questions/58369988/how-do-i-bind-arguments-to-a-constructor

Thanks,
-- 
Mikhail


More information about the cs3 mailing list