I have a std::map
container variable in my class that is populated with objects of my nested-class:
class Logger {
private:
//...
class Tick{
///stores start and end of profiling
uint32_t start, lastTick,total;
/// used for total time
boost::mutex mutexTotalTime;
///is the profiling object started profiling?
bool started;
public:
Tick(){
begin();
}
/*
Tick(const Tick &t){
start = t.start;
lastTick = t.lastTick;
total = t.total;
started = t.started;
}
*/
uint32_t begin();
uint32_t end();
uint32_t tick(bool addToTotalTime = false);
uint32_t addUp(uint32_t value);
uint32_t getAddUp();
};
std::map<const std::string, Tick> profilers_;
//...
public:
//...
Logger::Tick & Logger::getProfiler(const std::string id)
{
std::map<const std::string, Tick>::iterator it(profilers_.find(id));
if(it != profilers_.end())
{
return it->second;
}
else
{
profilers_.insert(std::pair<const std::string, Tick>(id, Tick()));
it = profilers_.find(id);
}
return it->second;
}
//...
};
the above code will not compile if I dont provide a copy constructor while I thought the default copy constructor should be already in place?! Am I missing any concept? thanks