Questions tagged [parameter-pack]

171 questions
0
votes
2 answers

Validating std::function with variadic args against a 'kind' hierarchy

I have a system (C++14, using Visual Studio 2015 & GCC 4.9.2) where we have a number of different kinds of 'events' that can cause a callback to occur, and a hierarchy of classes which identify the kind of event and other custom properties specific…
Danny S
  • 457
  • 4
  • 15
0
votes
1 answer

Using a parameter pack to generate objects

I am looking to create an object that can instantiate a class on command. The reason why I want to do it like this, is because I have to create instances of an object, that all have the same initial parameters read from a file, but I want to load…
Lala5th
  • 1,137
  • 7
  • 18
0
votes
1 answer

Iterate over parameter pack of types

I'm trying to simplify usage of pybind11 when binding templates. For now I have a parameter pack of types and I need to call a function cl.def() (look at the code below) with each type from that parameter pack. Also there is a vector of names and…
Kerim
  • 171
  • 3
  • 10
0
votes
1 answer

How do I stop this templated function value-initializing a new constructed object?

If I can a parameter pack for the constructor arguments when I create a new object and I don't provide any constructor arguments then the result will be: new T(); which will value-initialize the object if it doesn't have a user-provided constructor.…
Zebrafish
  • 11,682
  • 3
  • 43
  • 119
0
votes
1 answer

Using variadic template arguments for arbitrary number of classes

I have a situation where I need a class FaceProp that maintains/holds other classes for actual face types. These could be any types of faces like boundary faces, solid faces, internal faces etc etc. I wanted to implement FaceProp using the variadic…
ATK
  • 1,296
  • 10
  • 26
0
votes
0 answers

Passing parameter packs to a template with parameter non-pack and parameter-pack

The following code is an error in GCC trunk and Clang trunk: https://godbolt.org/z/YYzdeh #include template