----- Mensaje original ----- De: hongleij@126.com Fecha: Miércoles, Junio 27, 2007 10:16 am Asunto: [Boost-users] [multi-index] how to use in herit member as index Para: boost-users@lists.boost.org
//boost #include
#include #include using namespace ::boost; using namespace ::boost::multi_index; #include <string>
struct Peer { std::string userid; }; struct CPeer:public Peer { int index; }; struct userid{};
typedef multi_index_container< CPeer, indexed_by<
hashed_unique
> CPeersType;
//how could i use userid as an index in CPeer ,not in Peer,
Hello,
If you're using Boost 1.34, then you can simply use
hashed_unique<
tag<userid>,
member
CPeersType;
(more on custom key extractors at http://tinyurl.com/39shzv ). Thank you for using Boost.MultiIndex, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo