samedi 31 décembre 2016

Is there any way to return three containers in one getter?

I'm wondering is there any way to get access to three containers at once. I have class like :

class DataContainer
{

private:
    std::vector<Rental*> rentals;
    std::vector<Vehicle*> vehicles;
    std::vector<Client*> clients;

public:
    DataContainer();
    bool loadObjects();
    bool createRentals();
    std::string showVehicles() const;
    std::string showClients() const;
    std::string showDetails() const ;
    std::tuple< std::vector<Vehicle*>type1, std::vector<Client*>type2, std::vector<Rental*>type3 > getContainers();
    virtual ~DataContainer();

};

I would like to have possibility to access from other class to these containers, that's why I would like to set some getter, but here comes my problem. I don't know if I'm doing something wrong but the errors I get are :

include\DataContainer.h|74|error: template argument 1 is invalid|
||=== Build failed: 1 error(s), 2 warning(s) (0 minute(s), 1 second(s)) ===|

my function looks like this :

std::tuple< std::vector<Vehicle*>type1, std::vector<Client*>type2, std::vector<Rental*>type3 > DataContainer::getContainers()
{
   return std::make_tuple(vehicles,clients,rentals);
}   

Hope someone will be able to give me some hint, if that makes any difference I'm working on C++11.

Aucun commentaire:

Enregistrer un commentaire