Boost logo

Boost Users :

From: T. Allison (tallison_at_[hidden])
Date: 2007-09-17 12:41:10


Joaquín Mª López Muñoz wrote:
>
>
>> bool operator<(const Observation &rhs);
>
> There's an error here (though it's not the primary error,
> and it might be the case you've got it right in your original
> code): operator< should be const.
>
>
You're right - about the only thing I did correctly was make operator<
const!

Joaquín Mª López Muñoz wrote:
>
>> The code will dynamically create thousands of these things to be
>> used in many ways, so I've opted to use shared_ptr:
>> typedef boost::shared_ptr<Observation> SharedObservation;
>> [...] If I write:
>> typedef boost::multi_index_container<SharedObservation>
>> ObservationCollection;
>
> This is probably not what you meant:
> [...]
> Change the code to
>
> void AnotherClass::functionUsingCollection(data)
> {
> master_collection.find(Observation(data));
> ...
>
> and be done (hopefully). Hope this helps. Please report back.
>
> Joaquín M López Muñoz
> Telefónica, Investigación y Desarrollo
>

You were exactly right about my intent and the fix. The recommended fix
works exactly as I intended.

-- 
View this message in context: http://www.nabble.com/Newbie-MultiIndex-shared_ptr-non-trivial-class-question-tf4432403.html#a12739543
Sent from the Boost - Users mailing list archive at Nabble.com.

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