Is there a way (in C++17) to achieve something similar to a forward declare, in a template? What I want to achieve is something like this:
template<typename T, SizeType D, typename SizeType = int>
Obviously here D
depends on SizeType
, so it must come before it. But in that case I cannot set a default parameter unless D
also has a default parameter (which I do not want). Basically I want to be able to "declare" SizeType
before D, but "define" it after it.
Edit: Here is an example of how I would like to use it:
template<typename T, SizeType D, typename SizeType = int>
class StaticArray{};
//...
StaticArray<float, 5> s; // = StaticArray<float, 5, int>
StaticArray<float, (1<<40), size_t>; // 1<<40 doesn't fit in int