C++: Determine the class of a pointer type in the use of Boost MultiIndex
问题 The answer to this question has general application, but I will motivate it with the following example: I have the following template class: template <typename V> class Collection { public: struct id{}; struct name{}; // A collection parameterized by type V that is indexed by a string 'name' // and a integer 'id' // The type V must implement 'get_id()' and a 'get_name()' functions typedef multi_index_container < V, indexed_by< ordered_unique< tag<id>, const_mem_fun<V, unsigned int, &V::get_id