3

I would like to have something like this (warning: invalid code):

template<std::tuple<typename T, typename... Args>>
class nDimensionalPoint

This way, I could work with n-dimensional points one dimension at a time. Of course, I could avoid the std::tuple part by declaring template<typename T, typename... Args> and simply passing the coordinates in each dimension in a vector of its own, but that creates the following difficulty: One needs to somehow bind together the coordinates hidden in args.... Therefore, I would like a cleaner way of making it explicit that the underlying type is variadic tuple. How this could be done?

1 Answer 1

3

You might declare it as partial specialization as

template<typename>
class nDimensionalPoint;
template<typename T, typename... Args>
class nDimensionalPoint<std::tuple<T, Args...>> {};

then use it like

nDimensionalPoint<std::tuple<int, char>> dp ...;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.