我用谷歌搜索了boost的人,但没有找到任何例子。可能这是一个愚蠢的问题......无论如何。
所以我们有这个人的著名电话簿:
typedef multi_index_container<
phonebook_entry,
indexed_by<
ordered_non_unique<
composite_key<
phonebook_entry,
member<phonebook_entry,std::string,&phonebook_entry::family_name>,
member<phonebook_entry,std::string,&phonebook_entry::given_name>
>,
composite_key_compare<
std::less<std::string>, // family names sorted as by default
std::greater<std::string> // given names reversed
>
>,
ordered_unique<
member<phonebook_entry,std::string,&phonebook_entry::phone_number>
>
>
> phonebook;
phonebook pb;
...
// look for all Whites
std::pair<phonebook::iterator,phonebook::iterator> p=
pb.equal_range(boost::make_tuple("White"), my_custom_comp());
my_custom_comp() 应该如何?我的意思是这对我来说很清楚然后它boost::multi_index::composite_key_result<CompositeKey>
作为一个参数(由于编译错误:)),但是在那种特殊情况下 CompositeKey 是什么?
struct my_custom_comp
{
bool operator()( ?? boost::multi_index::composite_key_result<CompositeKey> ?? ) const
{
return blah_blah_blah;
}
};
提前致谢。