![]() |
Lumiera 0.pre.04~rc.1
»edit your freedom«
|
verify metaprogramming manipulation on a variadic parameter pack. More...
Go to the source code of this file.
verify metaprogramming manipulation on a variadic parameter pack.
The unittest VariadicArgumentPicker_test calls a variadic function with different number of arguments and it employs variadic-helper.hpp to alter the order of passed arguments.
The primary difficulty when dealing with variadic templates is the fact that a variadic parameter pack is not a first class type, rather a special language construct which can only be used to perform a pattern match. For this reason, metaprogramming has to proceed "backwards", by invoking a delegate template, thereby dissecting the parameter pack by a pattern match. The key technique for more elaborate manipulation is to construct a variadic index sequence as a helper, and then to expand that index sequence to drive instantiation of a helper template on individual arguments.
Definition in file variadic-argument-picker-test.cpp.
#include "lib/test/run.hpp"#include "lib/meta/variadic-helper.hpp"#include "lib/format-string.hpp"#include "lib/format-cout.hpp"#include "lib/format-util.hpp"#include <utility>Namespaces | |
| namespace | lib |
| Implementation namespace for support and library code. | |
| namespace | lib::meta |
| namespace | lib::meta::test |
| namespace | lib::meta::test::anonymous_namespace{variadic-argument-picker-test.cpp} |
Classes | |
| struct | N< n > |
| class | VariadicArgumentPicker_test |
Functions | |
| template<class... ARGS> | |
| string | fun (ARGS &&...args) |
| Variadic test function to invoke. | |
| LAUNCHER (VariadicArgumentPicker_test, "unit common") | |
| Register this test class... | |