rachelsing
September 12th, 2002, 10:26 AM
I get an error when compiling the follow code:
class SomeType
{
public:
SomeType() { };
SomeType(SomeType& x) {};
};
std::vector<SomeType> array;
SomeType sometype1;
array.push_back(sometype1);
I get:
error C2558: class 'SomeType' : no copy constructor available
But I defined the copy constructor. If I comment out that line and uses the default copy constructor the code compiles.
class SomeType
{
public:
SomeType() { };
SomeType(SomeType& x) {};
};
std::vector<SomeType> array;
SomeType sometype1;
array.push_back(sometype1);
I get:
error C2558: class 'SomeType' : no copy constructor available
But I defined the copy constructor. If I comment out that line and uses the default copy constructor the code compiles.