Lambda Expressions

From RAD Studio
Jump to: navigation, search

Go Up to Modern C++ Features Supported by RAD Studio Clang-enhanced C++ Compilers


Lambda expressions are a C++11 feature that allows you to define inline, anonymous methods.

The following code snippet shows a simple lambda expression:

[](int x, int y) {
  return x + y;
};

Using Lambda Expressions with Delphi Libraries

You can use lambda expressions with Delphi libraries to handle Delphi anonymous methods.

When you use the Parallel Programming Library, you can use lambda expressions as well; see Using TTask and Using TTask::IFuture. The only difference is that TParallel::For requires an explicit cast to the corresponding TProc or TFunc template.

See Also