libsigc++ 2.2.10

- Main Page
- Modules
- Namespaces
- Classes

Classes | Modules

# Lambdas

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

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

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

## Detailed Description

libsigc++ ships with basic lambda functionality and the sigc::group adaptor, which 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, for example, lambda selectors can be used 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)