]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/metaparse/doc/currying.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / metaparse / doc / currying.qbk
CommitLineData
7c673cae
FG
1[#currying]
2[section Currying]
3
4A [link metafunction template metafunction] supports ['currying] when it accepts
5less arguments than it normally expects. When less arguments are provided, then
6it returns a [link metafunction_class template metafunction class] expecting
7the remaining arguments. That template metafunction class is also expected to
8support currying.
9
10For example assuming the following metafunction is given:
11
12 template <class A, class B>
13 struct plus;
14
15It takes two values, adds them and returns their result. For example:
16
17 static_assert(
18 plus<
19 std::integral_constant<int, 11>,
20 std::integral_constant<int, 2>
21 >::type::value == 13,
22 "This should work"
23 );
24
25If it supports currying, then the following should also work:
26
27 using inc = plus<std::integral_constant<int, 1>>;
28
29 static_assert(
30 inc::apply<std::integral_constant<int, 12>>::type::value == 13,
31 "This should work"
32 );
33
34The above example defines the `inc` template metafunction class by calling
35`plus` with just one argument: the [link boxed_value boxed] `1` value.
36
37[endsect]
38