I want to write a class which has a parameter pack and a function. This function should return the value itself, if there is only one type in the pack and otherwise it should return a tuple. If there pack is empty it can return an empty tuple or void, I don't mind.
Something like this(pseudocode):
template<typename ...Args>
class A{
std::tuple<Args...> data;
#if sizeof...(Args)
std::tuple<Args...> get();
#else
Args[0] get();
#endif
};
I think my current solution is very complicated and it doesn't work if Args is empty.
Current solution:
template<bool EnableBool = true>
typename std::enable_if<
EnableBool && std::tuple_size_v<decltype(data)> == 1, typename std::tuple_element<0, decltype(data)>::type>::type
get();