Top "Std-function" questions

A C++11 class template that is callable like a function, and wraps another callable type and forwards calls to it.

std::function and std::bind: what are they, and when should they be used?

I know what functors are and when to use them with std algorithms, but I haven't understood what Stroustrup says …

c++ c++11 std-function stdbind
How to properly check if std::function is empty in C++11?

I was wondering how to properly check if an std::function is empty. Consider this example: class Test { std::function&…

c++ c++11 std-function
Usage and Syntax of std::function

It is necessary to me to use std::function but I don't know what the following syntax means. std::function&…

c++ function-pointers std-function
std::function vs template

Thanks to C++11 we received the std::function family of functor wrappers. Unfortunately, I keep hearing only bad things about …

c++ templates c++11 std-function
How to directly bind a member function to an std::function in Visual Studio 11?

I can easily bind member functions to a std::function by wrapping them with a lambda expression with capture clause. …

c++ c++11 member-functions std-function
C++11 std::set lambda comparison function

I want to create a std::set with a custom comparison function. I could define it as a class with …

c++ stl c++11 lambda std-function
Should I copy an std::function or can I always take a reference to it?

In my C++ application (using Visual Studio 2010), I need to store an std::function, like this: class MyClass { public: typedef …

c++ lambda std-function
Lambda of a lambda : the function is not captured

The following program do not compile : #include <iostream> #include <vector> #include <functional> #include <…

c++ c++11 lambda std-function
C++ lambda capture this vs capture by reference

If I need to generate a lambda that calls a member function, should I capture by reference or capture 'this'? …

c++ c++11 lambda std-function
Using 'void' template arguments in C++

Take the following minimal example: using Type1 = std::function<void(void)>; template <typename T> using Type2 = …

c++ templates c++11 std-function