Questions tagged [parameter-pack]

171 questions
0
votes
1 answer

How to get the pointer to an object from a parameter pack

I'm having trouble with getting 2 different objects of the same type to have pointers to different objects using a parameter pack. Here is Controller.h: using expand_type = int[]; template class Controller { public: …
Ryan
  • 1
  • 2
-1
votes
1 answer

How can i combine multiple variadic templates or split parameter pack?

I am currently trying to define a generic multiplication operator for std::functions. I want to do this using multiple variadic templates. The partial specializations look as follows: template using op_Type = typename…
-1
votes
1 answer

What does `class function<_Res(_ArgTypes...)>` mean?

The code of std::function in gcc has these two lines: template class function<_Res(_ArgTypes...)> // <-- unclear to me The first part template... _ArgTypes denotes a "parameter pack", i.e., a variadic number…
Ayrat
  • 1,221
  • 1
  • 18
  • 36
-1
votes
2 answers

Call function-pointer using only necessary arguments

Let's assume I have the structure X declared and defined like this: struct X { int i; X(int i = 0) : i(i) { std::cout << "X(int i = " << i << "): X[" << this << "]" << std::endl; } int multiply(int a, int b = 1) { return i * a * b;…
ChaosNe0
  • 37
  • 7
-1
votes
1 answer

Initializing vector with variadic template

Basically I need template function, that would compare container's size with some constant. So I need to make std::vector of containers and check if predicate compSize is true. template < int x, class Container > bool compSize(Container cont) { …
-4
votes
2 answers

Why I can't use parameter pack in the constructor

Here is my code in hpp: template class TelemetryCompactDataStrategy : public TelemetryCommonDataStrategy { static_assert((Bits + ...) <= 32, "Bit count must not exceed 32."); public: static constexpr auto bitSize = (Bits +…
wcc chn
  • 1
  • 2
1 2 3
11
12