From c34e1520e5937795d86beffa0b7293ea5dca7227 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 1 Apr 2017 19:46:45 +0300 Subject: [PATCH] Update documentation. --- doc/html/mp11.html | 78 ++++++++++++++++++++++++++++++++++++++-- doc/mp11.qbk | 1 + doc/mp11/bind.qbk | 41 +++++++++++++++++++++ doc/mp11/definitions.qbk | 9 ++++- 4 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 doc/mp11/bind.qbk diff --git a/doc/html/mp11.html b/doc/html/mp11.html index b1cc0c6..4a64ff4 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -157,6 +157,14 @@
mp_or<T...>
mp_any<T...>
+
Bind, <boost/mp11/bind.hpp>
+
+
mp_arg<I>
+
_1, + ..., _9
+
mp_bind<F, + T...>
+
Integer Sequences, <boost/integer_sequence.hpp>
@@ -215,7 +223,7 @@ Definitions

- A list is a — possibly but not necessarily variadic — template + A list is a — usually but not necessarily variadic — template class whose parameters are all types, for example mp_list<char[], void>, mp_list<>, @@ -251,6 +259,16 @@

struct N { static int constexpr value = 2; };
 
+

+ A set is a list whose elements are unique. +

+

+ A map is a list of lists, the inner lists having at least + one element (the key.) The keys of the map must be unique. For example, +

+
using M1 = std::tuple<std::pair<int, int*>, std::pair<float, float*>, std::pair<void, void*>>;
+using M2 = mp_list<mp_list<int, int*>, mp_list<float>, mp_list<char, char[1], char[2]>>;
+

@@ -1609,6 +1627,62 @@

+
+ +
template<std::size_t I> struct mp_arg;
+
+

+ mp_arg<I> + is a quoted metafunction whose nested template fn<T...> returns the I-th + zero-based element of T.... +

+
+
+ +
using _1 = mp_arg<0>;
+using _2 = mp_arg<1>;
+using _3 = mp_arg<2>;
+using _4 = mp_arg<3>;
+using _5 = mp_arg<4>;
+using _6 = mp_arg<5>;
+using _7 = mp_arg<6>;
+using _8 = mp_arg<7>;
+using _9 = mp_arg<8>;
+
+

+ _1 to _9 + are placeholder types, the equivalent to the placeholders of boost::bind. +

+
+
+ +
template<template<class...> class F, class... T> struct mp_bind;
+
+

+ mp_bind<F, T...> is a quoted metafunction that implements + the type-based equivalent of boost::bind. + Its nested template fn<U...> returns F<V...>, where V... is T... with the placeholders replaced by the + corresponding element of U... and the mp_bind + expressions replaced with their corresponding evaluations against U.... +

+

+ For example, mp_bind<F, int, _2, mp_bind<G, _1>>::fn<float, void> + is F<int, void, G<float>>. +

+
+
+
- +

Last revised: March 25, 2017 at 01:01:08 GMT

Last revised: April 01, 2017 at 16:43:16 GMT


diff --git a/doc/mp11.qbk b/doc/mp11.qbk index f1f55e9..db40f52 100644 --- a/doc/mp11.qbk +++ b/doc/mp11.qbk @@ -38,6 +38,7 @@ The contents of the library are in namespace `boost::mp11`, unless specified oth [include mp11/set.qbk] [include mp11/map.qbk] [include mp11/function.qbk] +[include mp11/bind.qbk] [include mp11/integer_sequence.qbk] [include mp11/tuple_for_each.qbk] diff --git a/doc/mp11/bind.qbk b/doc/mp11/bind.qbk new file mode 100644 index 0000000..0278122 --- /dev/null +++ b/doc/mp11/bind.qbk @@ -0,0 +1,41 @@ +[/ + / Copyright 2017 Peter Dimov + / + / Distributed under the Boost Software License, Version 1.0. (See + / accompanying file LICENSE_1_0.txt or copy at + / http://www.boost.org/LICENSE_1_0.txt) + /] + +[section:bind Bind, ``] + +[section `mp_arg`] + template struct mp_arg; + +`mp_arg` is a quoted metafunction whose nested template `fn` returns the `I`-th zero-based element of `T...`. +[endsect] + +[section `_1`, ..., `_9`] + using _1 = mp_arg<0>; + using _2 = mp_arg<1>; + using _3 = mp_arg<2>; + using _4 = mp_arg<3>; + using _5 = mp_arg<4>; + using _6 = mp_arg<5>; + using _7 = mp_arg<6>; + using _8 = mp_arg<7>; + using _9 = mp_arg<8>; + +`_1` to `_9` are placeholder types, the equivalent to the placeholders of `boost::bind`. +[endsect] + +[section `mp_bind`] + template class F, class... T> struct mp_bind; + +`mp_bind` is a quoted metafunction that implements the type-based equivalent of `boost::bind`. Its nested +template `fn` returns `F`, where `V...` is `T...` with the placeholders replaced by the corresponding element +of `U...` and the `mp_bind` expressions replaced with their corresponding evaluations against `U...`. + +For example, `mp_bind>::fn` is `F>`. +[endsect] + +[endsect] diff --git a/doc/mp11/definitions.qbk b/doc/mp11/definitions.qbk index 5974e42..23586d7 100644 --- a/doc/mp11/definitions.qbk +++ b/doc/mp11/definitions.qbk @@ -8,7 +8,7 @@ [section Definitions] -A /list/ is a '''—''' possibly but not necessarily variadic '''—''' template class whose parameters are all types, +A /list/ is a '''—''' usually but not necessarily variadic '''—''' template class whose parameters are all types, for example `mp_list`, `mp_list<>`, `std::tuple`, `std::pair`, `std::shared_ptr`. A /metafunction/ is a class template or a template alias whose parameters are all types, for example `std::add_pointer_t`, @@ -29,4 +29,11 @@ An /integral constant type/ is a class with a public member `value` that is an i struct N { static int constexpr value = 2; }; +A /set/ is a list whose elements are unique. + +A /map/ is a list of lists, the inner lists having at least one element (the key.) The keys of the map must be unique. For example, + + using M1 = std::tuple, std::pair, std::pair>; + using M2 = mp_list, mp_list, mp_list>; + [endsect]