problem with std::map

G

g

hello!

this the code!


std::map<std::string,Services*>::iterator
iter=transactions.find(transaction);
if(iter != transactions.end())
{
return iter->second;
//return transactions.[transaction];
}
else
return NULL;

How can I get a copy of iter->second?which is the best way?
Sercices is a base class and I want a copy of the derived.
these objects are proxies for services.
the reason i want a copy is becouse I dont want to have the
sychronization in the proxies
becouse it would be overkill,it will serialize the execution of each
service,
no matter if they don't conflict.

how can I get it? switch/factory before return??


thanks!
 
G

g

if(iter != transactions.end())
{
Services *serv= iter->second;
return serv->clone();
}
else
return NULL;


is this ok or there is a better one??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top