Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::multi_index
From: ppatel_at_[hidden]
Date: 2011-04-06 21:28:56


Thanks for your answer Igor. Unfortunately that is out of my control.
This is the type of structure we used across multiple applications. I
was checking key extractors and I think that might work but haven't
tried out yet.

Thanks
Priyank



On Apr 6, 2011, at 3:32 PM, "Igor R" <boost.lists_at_[hidden]> wrote:

> 2011/4/6 <ppatel_at_[hidden]>:
>> Hello,
>>
>>
>>
>> I have a question regarding creating composite key/specifying
>> length for
>> arrays while using multi_index container based on following
>> structure.
>>
>>
>>
>> struct TestStruct {
>>
>> char firstKey[50];
>>
>> char secondKeyPart[3];
>>
>> uint32_t thirdKeyPart;
>>
>> ……Some other information….
>>
>> };
>>
>>
>>
>> Do I really read to specify this lengths for character arrays? If
>> yes, how
>> do I do that while specifying key parts as below?
>>
>> typedef multi_index_container <
>>
>> TestStruct,
>>
>> indexed_by<
>>
>> //non-unique as some subscribers might have more than one number
>>
>> hashed_unique<
>>
>> composite_key<
>>
>> TestStruct,
>>
>> member<TestStruct, char*, &TestStruct::firstKeyPart>,
>>
>> member<TestStruct, char*, &TestStruct::secondKeyPart>,
>>
>> member<TestStruct, uint32_t, &TestStruct::thirdKeyPart>,
>>
>> >
>>
>> >
>>
>> >
>>
>>> TS;
>
>
> The above keys will hash the pointer values, which is probably not
> what you want.
> If you change plain C arrays to std::string, it will work as you
> expect.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net