Consider a code:
#include <iostream>
template <class T>
struct outer {
template <class... Args>
struct inner {
static constexpr bool value = false;
};
template <class... Other>
struct inner<T, Other...> {
static constexpr bool value = true;
};
};
int main() {
std::cout << outer<int>::inner<int, void>::value << std::endl;
};
It does compile in both g++ and clang++ but I am not convinced it is legal. As far as I know one cannot for example specialize template method for template class if not explicit specializing the class itself. How come rules are different for inner classes?
Aucun commentaire:
Enregistrer un commentaire