mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-30 06:18:50 +08:00
Fixed missing copy constructor.
This commit is contained in:
parent
9cfbe76358
commit
43806c9a9c
@ -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)
|
||||
{
|
||||
|
||||
9
vector.h
9
vector.h
@ -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.
|
||||
//*************************************************************************
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user