Reputation: 229
I am using constexpr to declare size of std::array.
constexprt auto sizearr = 99;
Based on compile time type deduction on sizearr I want to find type of index used to iterate array
char offset; //Class member
when sizearr changed to
constexprt auto sizearr = 65000;
I want offset to auto declared as type of int instead of changing manually to int.
I am assuming there must be way to mix auto, decltype and constexpr to do this.
Upvotes: 0
Views: 409
Reputation: 101
Use log2(arraysize)/8 (cast to int) as a non-type template parameter N.
The template is a struct template that defines a type that you need.
Partial specialize based upon value of N.
Upvotes: 0