他の質問で学んだように、aと整数composite_key
を持つ構造体にaを使用できます。std::vector
今私の質問は:hashed_indeciesを操作するためにこれをどうにかして使用できますか?
これに似た例を次に示します。
struct unique_property
{
//the pair of int and std::vector<int> shall be unique
int my_int;
std::vector<int> my_vec;
};
typedef multi_index_container<
unique_property,
indexed_by<
hashed_unique< // indexed by my_int and every entry of my_vec
composite_key<
street_entry,
member<unique_property,int,&unique_property::my_int>,
member<unique_property,std::vector<int>,&unique_property::my_vec>
>
>,
random_access< >
>
> property_locator;
問題は(もちろん)astd::vector<int>
が適切なハッシュキーではないということです。このコードをエレガントなラッパー(またはそのようなもの)に入れて、のすべてのエントリからハッシュキーを生成することはmy_vec
できますか?