mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Merge remote-tracking branch 'origin/development'
# Conflicts: # support/Release notes.txt
This commit is contained in:
parent
d7f9d1a7fb
commit
54981cfaa4
@ -313,6 +313,18 @@ namespace etl
|
||||
other = temp;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// Reset back to invalid.
|
||||
//***************************************************************************
|
||||
void reset()
|
||||
{
|
||||
if (valid)
|
||||
{
|
||||
storage.template get_reference<T>().~T();
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typename etl::aligned_storage_as<sizeof(T), T>::type storage;
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
===============================================================================
|
||||
11.00.1
|
||||
Added reset() to etl::optional
|
||||
|
||||
===============================================================================
|
||||
11.00.0
|
||||
New directory structure.
|
||||
|
||||
@ -396,5 +396,15 @@ namespace
|
||||
CHECK_EQUAL(data1, original2);
|
||||
CHECK_EQUAL(data2, original1);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_reset)
|
||||
{
|
||||
etl::optional<Data> data(Data("1"));
|
||||
CHECK(bool(data));
|
||||
|
||||
data.reset();
|
||||
CHECK(!bool(data));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user