libsigc++ 2.0: Lambdas

Main Page Groups Namespaces

# Lambdas

Collaboration diagram for Lambdas:

libsigc++ ships with basic lambda functionality and the sigc::group adaptor that uses lambdas to transform a functor's parameter list. More...

## Modules
| group()
| sigc::group() alters an arbitrary functor by rebuilding its arguments from one or more lambda expressions.

## Classes
struct | sigc::lambda_base
| A hint to the compiler. More...
struct | sigc::lambda<T_type>
| Lambda type. More...

## Detailed Description

libsigc++ ships with basic lambda functionality and the sigc::group adaptor that uses lambdas to transform a functor's parameter list.

The lambda selectors sigc::_1, sigc::_2, ..., sigc::_9 are used to select the first, second, ..., nineth argument from a list.

Examples:

         std::cout << sigc::_1(10,20,30); // returns 10
         std::cout << sigc::_2(10,20,30); // returns 20
         ...

Operators are defined so that lambda selectors can be used e.g. as placeholders in arithmetic expressions.

Examples:

         std::cout << (sigc::_1 + 5)(3); // returns (3 + 5)
         std::cout << (sigc::_1 * sigc::_2)(7,10); // returns (7 * 10)