I am trying to find object in set and then call that objects method. Code looks like this:
void ExpenseManager::addCategory(const string &userName, const string &categName){
Client temp(userName);
impl->clientsSet.find(temp)->addNewCategory(categName);
}
This method is in Expensemanager class. impl here is pointer to inner class, where clientsSet set is defined (I store Client objects in there). addNewCategory() is a method in Client class.
I get an error at impl position saying: "Error 1 error C2662: 'void ExpenseManagerNamespace::Client::addNewCategory(const std::string &)' : cannot convert 'this' pointer from 'const ExpenseManagerNamespace::Client' to 'ExpenseManagerNamespace::Client &'"
Any ideas?
EDIT: Inner class and contructor:
class ExpenseManager::Implementation{
private:
set<Client> clientsSet;
set<Client>::iterator clientPosSet;
friend class ExpenseManager;
};
// Constructors/destructor-----------------------------------------------
ExpenseManager::ExpenseManager()
: impl(new Implementation()){
}