std::reference_wrapper and polymorphic containers
问题 I am trying to make a polymorphic vector using std::reference_wrapper for these classes: struct Int2TypeBase{ virtual void which(){ std::cout << "Int2TypeBase" << "\n";} }; template <int v> struct Int2Type : public Int2TypeBase { enum { value = v }; void which(){ std::cout << "Int2Type<" << value << ">""\n";} friend bool operator==(const Int2Type& lhs, const Int2Type& rhs){ return lhs.v == rhs.v; } }; Now I am trying to make use of std::reference_wrapper like this: int main(){ using namespace