Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Front Page / Tutorial: Metafunctions and Higher-Order Metaprogramming / More Lambda Capabilities / Partial Metafunction Application

Partial Metafunction Application

Consider the lambda expression mpl::plus<_1,_1>. A single argument is directed to both of plus's parameters, thereby adding a number to itself. Thus, a binary metafunction, plus, is used to build a unary lambda expression. In other words, we've created a whole new computation! We're not done yet, though: By supplying a non-placeholder as one of the arguments, we can build a unary lambda expression that adds a fixed value, say 42, to its argument:

mpl::plus<_1, mpl::int_<42> >

The process of binding argument values to a subset of a function's parameters is known in the world of functional programming as partial function application.