
8 Aug
2005
8 Aug
'05
2:58 p.m.
Example 6: complex searches and foreign keys See source code. This program illustrates some advanced techniques that can be applied for complex data structures using multi_index_container. Consider a car_model class for storing information about automobiles. On a first approach, car_model can be defined as: struct car_model { std::string model; std:string manufacturer; int price; }; This definition has a design flaw that any reader acquainted with relational databases can easily spot: The manufacturer member is duplicated among all cars having the same manufacturer. --- This definition also has a syntax error that any C++ programmer can easily spot! :) Mike