Although I\'m doubtful, I\'m curious as to whether it\'s possible to extract primitive-type template parameters from an existing type, perhaps using RTTI.
For exampl
You can easily do this in C++11 using argument deduction and unevaluated contexts (note that demo uses C++14's variable template feature for convenience).
#include
#include
template
struct foo {};
template
struct val {
static constexpr auto N = arg_N;
};
template typename T, int N>
constexpr auto extract(const T&) -> val;
template
constexpr auto extract_N = decltype(extract(std::declval()))::N;
int main() {
std::cout << extract_N>;
}
Live demo