I want to create an object of std::array<T, N>
but the problem is I can only use functions that return a constexpr
type or compiler will complain. The problem here is that I need to calculate the length of this array based on another array's size which could be something like this:
template <typename T>
struct DataLength
{
template <typename iter>
size_t maxPossibleLength(iter begin, iter end)
{
size_t m_size = 0;
while (begin != end) {
m_size = m_size << 8 | std::numeric_limits<T>::max(); /* 0xff for uchar*/
begin++;
}
return m_size;
}
}
how can i convert the output of this function so i can use it instead of N
?