Boost logo

Boost :

From: zlf (zlfcn_at_[hidden])
Date: 2005-04-26 11:49:06


Hi,
    I have to classes.

    class Car;
    class Limousine : public Car{
    ...
    };

    And two vector
    vector<Car> Cars;
    vector<Limousine> Limousines;

    I want to set vector Limousines's to vector Cars( Cars = Limousines ).
One method is:

    vector<Limousine>::iterator pos;
    for ( pos = Limousines.begin() ; pos != Limousines.end() ; ++ pos ){
        Car car;
        car = static_cast <Car>(*pos);
        Cars.push_back ( car );
    }

    However, I think it is to clumsy :0 .Who can provide me with a easier
method(e.g:using copy() or other std function).thx

zlf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk