parameter-pack Questions
1
Solved
I want to fill a tuple<Ts...> from a vector of variants. (NB: This question follows up on Creating a tuple from a folding expression return values , see 2nd comment to the answer )
Expanding ...
Helvetic asked 24/1, 2024 at 15:54
1
Solved
std::type_identity can be used to provide non-deducible context. So, I wondered if it will work on a deduced variadic list. But different compilers give different results.
https://godbolt.org/z/4cf...
Clipfed asked 17/1, 2024 at 13:5
1
Solved
Pack indexing was introduced in C++26 and I was hoping for this feature to have a significant impact on metaprogramming stuff, especially for indexing packs which would otherwise require workaround...
Painless asked 30/12, 2023 at 14:44
1
Solved
Let's say I have a function sum that takes a variadic parameter pack.
This function needs to ADD UP all of the parameters of the parameter pack using the operator +.
NOTE: It CANNOT use the operat...
Biographer asked 17/7, 2023 at 4:45
1
Solved
I am having trouble understanding how to forward the elements of a parameter pack in C++. Please take for example the code below:
#include <iostream>
void print(const int& value) {
std:...
Cofield asked 2/5, 2023 at 13:52
3
Not a duplicate of What is std::invoke in c++?. That quesiton asks specifically about that one and only feature. This question asks about a concept which can be 100% solved withOUT that feature, an...
Vitelline asked 30/9, 2022 at 6:38
1
Solved
Both g++ and clang++ reject the use of sizeof... when the argument is not parenthesized. For example, the following code is rejected:
template<typename... T> auto packsize = sizeof...T;
$ g+...
Coffey asked 1/6, 2022 at 20:59
1
Solved
i am trying to determine the size of all passed objects at compile time and then abort the build process via static_assert when a maximum size is exceeded.
#include <iostream>
template<cl...
Huihuie asked 24/5, 2022 at 10:13
1
A C++ function can have more than one parameter packs. Although it does not look very practical thing, it is still interesting to know language rules about them.
For example, in case of two overloa...
Ensemble asked 16/2, 2022 at 20:52
0
Here is instruction to create enum extending behavior. I have implemented it like this:
inheritenum.h:
template <typename BaseEnumT, typename EnumT>
class InheritEnum{
public:
InheritEnum...
Winburn asked 5/9, 2021 at 13:4
3
Solved
I've got a template function taking a parameter pack. I want to expand it into calls to a second function while also supplying the index of the item in the pack. I probably can work out how to do i...
Keil asked 2/9, 2021 at 0:21
1
Solved
I wrote a template that takes an istream& and a function and is supposed to extract all parameters for this function from the istream, call the function with these parameters and return the res...
Lacuna asked 21/9, 2020 at 8:16
0
When specifying the parameter packs for a type, I want to be able to accept not only typenames but also values of arbitrary types. Example:
template <thing... Things>
// ^^^^^ <- pseudo co...
Denice asked 20/8, 2020 at 18:30
1
Solved
I am trying to write a class template that uses a parameter-pack and implements a member function for each type contained in the parameter-pack.
This is what I have so far:
template <typename......
Holbert asked 25/6, 2020 at 15:17
1
Solved
I'd like to know if it's possible to filter the types passed to a variadic template (based on a predicate template) to produce another variadic template containing those types which satisfy the pre...
Tantalous asked 21/8, 2013 at 19:49
1
© 2022 - 2025 — McMap. All rights reserved.