Generic design mixed with curiously recurring template pattern. C++
问题 Consider this kind of problem. I have a Base class and three classes derived from Base . For instance: DerivedA , DerivedB and DerivedC . Each derived class has its unique container. Hence DerivedA has std::vector<int> , DerivedB has std::set<int> and DerivedC has std::map<int, std::string> . And I want an interface in Base to access the container of derived class on which it is currently pointed to. Base* d1 = new DerivedA; for(std::vector<int>::iterator iter = d1->begin(); iter != d1->end()