No. Inside the class template, the derived class is not yet fully defined (this is not a complete object in the standard standard).
Actually (working draft):
A class is considered a fully defined object type (or full type) when closed }
Therefore, you cannot expect to be able to access one of the members or what you declared in the derived class from the class template.
, enum , enum - ( ? ? ...). , . .
, , .
:
#include <map>
template<typename> struct traits;
template<typename Container>
struct ContainerBase
{
std::map<typename traits<Container>::Enum, int> _;
};
template<>
struct traits<struct ConcreteContainer> {
enum class Enum
{
left,
right
};
};
struct ConcreteContainer : ContainerBase<ConcreteContainer>
{};
int main() {
ConcreteContainer cc;
cc._[traits<ConcreteContainer>::Enum::left] = 0;
cc._[traits<ConcreteContainer>::Enum::right] = 1;
}
wandbox.