Currying for templates in C++ metaprogramming

前端 未结 2 677
深忆病人
深忆病人 2021-02-20 05:58

This is more of a conceptual question. I\'m trying to find the easiest way of converting a two-arg template (the arguments being types) into a one-arg template. I.e., binding on

2条回答
  •  情话喂你
    2021-02-20 06:17

    Yeah, I had this issue to. It took a few iterations to figure out a decent way to do this. Basically, to do this, we need to specify a reasonable representation of what we want and need. I borrowed some aspects from std::bind() in that I want to specify the template that I wish to bind and the parameters that I want to bind to it. Then, within that type, there should be a template that will allow you to pass a set of types.

    So our interface will look like this:

    template