Want to extend base_is_char_array
for any size character array.
Open to an entirely different solution than using is_base_of
. But I am constrained to the standard library for reasons far outside my control.
Outside of something gross that iterates to a fixed maximum array size, I'm out of ideas.
#include <array>
#include <iostream>
template< class Derived > auto base_is_char_array(){
return std::is_base_of<std::array<char, 10>, Derived>::value;
}
int main() {
class tester : std::array<char, 10>{};
std::cout << base_is_char_array<tester>() << std::endl;
std::cout << base_is_char_array<int>() << std::endl;
}