Fixed missing copy constructor.

This commit is contained in:
John Wellbelove 2016-01-14 17:34:08 +00:00
parent 9cfbe76358
commit 43806c9a9c
2 changed files with 20 additions and 0 deletions

View File

@ -139,6 +139,17 @@ namespace
CHECK(!data.empty());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_constructor)
{
Data data(initial_data.begin(), initial_data.end());
Data data2(data);
CHECK(data2 == data);
data2[2] = -1;
CHECK(data2 != data);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment)
{

View File

@ -103,6 +103,15 @@ namespace etl
ivector<T>::assign(first, last);
}
//*************************************************************************
/// Copy constructor.
//*************************************************************************
vector(const vector& other)
: ivector<T>(reinterpret_cast<T*>(&buffer), MAX_SIZE)
{
ivector<T>::assign(other.begin(), other.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************