Boost logo

Boost Users :

Subject: Re: [Boost-users] ���Multi_indexcomposite_key~~
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2010-07-25 07:17:02


isjk <isjk <at> foxmail.com> writes:

>
>
> thanks a lot!
>  
> now, I have a new problem:
>  
> Multi_index example 6: complex searches and forergn keys,
> struct car_manufacturer
> {
> std::string name;
> };
>
> struct car_model
> {
> std::string model;
> car_manufacturer* manufacturer;
> int price;
> };
>
> I want use "model, name" to query "price", and I maybe to modify "price".
>  
> How to do it? thanks.

Sorry but your question is not clear to me: what do you mean
by querying "price" using "model, name"? If you know the model
of a car then you just can use find() in the car_table to locate
the element and access the price.

As for modifying, there's a tutorial section on updating elements
of a multi_index_container at

http://www.boost.org/libs/multi_index/doc/tutorial/basics.html#ord_updating

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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