B
Barry
Hi,
Hope this doesn't get lost beneath all the spam.
I have the following container which I wish to create and store
objects of type MyObject in-
class Phase : public std::multimap<double, MyObject>
{
public:
Phase();
};
Phase:
hase()
{
MyObject myObject;
std:
air<double,Note> pair(0.0,myObject);
insert (pair);
}
A lot of copy constructors are being called for MyObject which I'd
like to avoid. But first, I'm not understanding what is happening for
the line: insert (pair);. Here, the copy constructor is called twice
and the default destructor once which suggests to me that a temp
object is create, but why? Finally, is there a way to cut down on all
the copies?
Thanks for your help,
Barry
Hope this doesn't get lost beneath all the spam.
I have the following container which I wish to create and store
objects of type MyObject in-
class Phase : public std::multimap<double, MyObject>
{
public:
Phase();
};
Phase:
{
MyObject myObject;
std:
insert (pair);
}
A lot of copy constructors are being called for MyObject which I'd
like to avoid. But first, I'm not understanding what is happening for
the line: insert (pair);. Here, the copy constructor is called twice
and the default destructor once which suggests to me that a temp
object is create, but why? Finally, is there a way to cut down on all
the copies?
Thanks for your help,
Barry