From ac28cf9b3ff5d6b43ea10859cc6f3318178fb593 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 13 May 2017 21:11:23 +0300 Subject: [PATCH] Use mp_product_q in example --- doc/html/mp11.html | 7 +++++-- doc/mp11/examples.qbk | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/html/mp11.html b/doc/html/mp11.html index f5a0537..10403a9 100644 --- a/doc/html/mp11.html +++ b/doc/html/mp11.html @@ -436,7 +436,7 @@ just a matter of applying it over the possible combinations of the variant values:

-
using R = mp_product<Qret<F>::template fn, std::remove_reference_t<V>...>;
+
using R = mp_product_q<Qret<F>, std::remove_reference_t<V>...>;
 

Why does this work? mp_product<F, @@ -444,6 +444,9 @@ where Ui traverse all possible combinations of list values. Since in our case all Li are std::variant, the result will also be std::variant. + (mp_product_q is the same + as mp_product, but for quoted + metafunctions such as our Qret<F>.)

One more step remains. Suppose that, as above, we're passing two variants @@ -1897,7 +1900,7 @@ - +

Last revised: May 13, 2017 at 18:01:55 GMT

Last revised: May 13, 2017 at 18:11:09 GMT


diff --git a/doc/mp11/examples.qbk b/doc/mp11/examples.qbk index 041c589..9e5a7de 100644 --- a/doc/mp11/examples.qbk +++ b/doc/mp11/examples.qbk @@ -115,10 +115,11 @@ We'll first define a helper quoted metafunction `Qret` that returns the resul With `Qret` in hand, a `variant` of the possible return types is just a matter of applying it over the possible combinations of the variant values: - using R = mp_product::template fn, std::remove_reference_t...>; + using R = mp_product_q, std::remove_reference_t...>; Why does this work? `mp_product, L2, ..., Ln>` returns `L1, ...>`, where `Ui` traverse all -possible combinations of list values. Since in our case all `Li` are `std::variant`, the result will also be `std::variant`. +possible combinations of list values. Since in our case all `Li` are `std::variant`, the result will also be `std::variant`. (`mp_product_q` is +the same as `mp_product`, but for quoted metafunctions such as our `Qret`.) One more step remains. Suppose that, as above, we're passing two variants of type `std::variant` and `F` is `[]( auto const& x, auto const& y ){ return x + y; }`. This will generate `R` of length 9, one per each combination, but many of those