
I'm am using boost::multi_index to hold a set of polymorphic entities. Due to efficiency concerns, I have to be able sort the container based on actual type. I was planning on sorting based on the return result of typeid. When I try this I get errors in <functional>. I am using VC++ 2005 Standard Edition SP1. What am I doing wrong, or, what is a better way of accomplishing what I am trying to do? #ifndef ENTITIES_ENTITYCONTAINER_H_ #define ENTITIES_ENTITYCONTAINER_H_ #include <boost/multi_index_container.hpp> #include <boost/multi_index/ordered_index.hpp> #include "Entity.h" namespace Entities { struct type{}; struct extractType { typedef const type_info& result_type; result_type operator()(const Entity * r)const // operator() must be const { return typeid(*r); } }; typedef boost::multi_index::multi_index_container< Entity *, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique<boost::multi_index::tag<type>, extractType> > > EntityContainer; }; #endif