Unpacking arguments of a functional parameter to a C++ template class -


I have functional template arguments for template classes in C ++.

I would like to take a template class foo to get a template parameter funny

  template & lt; Typename Fun & gt; Struct Foo {...}; Functions such as   

such as

  zero times (std :: string a, float b, char c) given {...}  

then foo < Bar & gt; :: args_t will be equal to a typedef

  std :: tuple & lt; Std :: string, float, four & gt;   

Is this possible? (Use of std :: tuple is only for concrete. More generally, I am thinking that it is possible to do the pattern-matching on the arguments of a working template parameter.)

Point

  template fu & lt; The typename A, typename B, typename c, typename, D like to avoid defining  foo  (* funny) (a, bb, cc) & gt; Structure foo {typedef std :: tuple & lt; A, B, C & gt; Args_t; };   

for which both require fixed fixes of the function, and the function's argument and return type are clearly required to be provided as a template parameter (Variadic Template Defining Foo might possibly solve a problem, but what about the latter?)

Thanks!

Announce the primary template and do not execute it.

  template & lt; Typename T & gt; Struct foo; // Unchanged Primary Template   

Then provide a partial specialization that matches the function type as a template argument.

  template & lt; Typename result, typename ... Args & gt; Straight foo & lieutenant; Results (ARG ...) & gt; {Args_t = std :: Google & lt; ARG ... & gt; };   

As a nested type

  foo < Decltype (bar) & gt; :: args_t   



Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -