Basically a way to use pointer to member as template (rather then as argument) but allow for any type - not just int. Why?... No real reason yet. The 2nd way works fine for my use cases so far.
struct Struct
{
int member;
int member2;
char member3;
};
template<typename T, T Struct::*Value>
struct Wrapper
{
};
template<typename... Args>
void StructStuff(Args... wrappers)
{
}
int main()
{
StructStuff(Wrapper<int, &Struct::member>(), Wrapper<char, &Struct::member3>());
return 0;
}
I think this covers everything apart from lack of deduction. The pointer to member value is on a templatable level so can spawn local statics specific to it. However, any way to make deduction work apart from with a macro (Macro would use decltype)?
It seems you want to deduce non-type template parameters from function arguments. This can't be done because compile-time decisions cannot depend on run-time parameters.
I'm not sure what the goal is, but if the problem was " allow for any type - not just int. ", you can deduce the types of the function parameters and decompose them: