Work-In-Progress

This commit is contained in:
John Wellbelove 2022-10-27 09:52:39 +01:00 committed by John Wellbelove
parent 8634480fa6
commit f858b36e82
4 changed files with 27 additions and 11 deletions

View File

@ -100,5 +100,5 @@ SOFTWARE.
#define ETL_BIP_BUFFER_SPSC_ATOMIC_FILE_ID "67"
#define ETL_REFERENCE_COUNTED_OBJECT_FILE_ID "68"
#define ETL_TO_ARITHMETIC_FILE_ID "69"
#define ETL_EXPECTED_FILE_ID "70"
#endif

View File

@ -91,7 +91,7 @@ namespace etl
public:
optional_invalid(string_type file_name_, numeric_type line_number_)
: optional_exception("optional: invalid", file_name_, line_number_)
: optional_exception("optional:invalid", file_name_, line_number_)
{
}
};
@ -100,7 +100,7 @@ namespace etl
/// An optional type.
/// If the optional type is not initialised then a type is not constructed.
/// See http://en.cppreference.com/w/cpp/utility/optional
///\tparam The type to store.
///\tparam T The type to store.
///\ingroup utilities
//*****************************************************************************
template <typename T, bool is_pod = etl::is_pod<T>::value>
@ -521,6 +521,8 @@ namespace etl
//*****************************************************************************
/// For POD types.
///\tparam T The type to store.
///\ingroup utilities
//*****************************************************************************
template <typename T>
class optional<T, true>

View File

@ -50,7 +50,7 @@ namespace etl
/// Result type.
//*****************************************************************************
template <typename TValue, typename TError>
class result
class ETL_DEPRECATED result
{
public:
@ -67,6 +67,7 @@ namespace etl
{
}
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move constructor
//*******************************************
@ -74,6 +75,7 @@ namespace etl
: data(etl::move(other.data))
{
}
#endif
//*******************************************
// Construct from a value
@ -86,7 +88,7 @@ namespace etl
//*******************************************
// Move construct from a value
//*******************************************
result(TValue&& value)
result(TValue&& value)
: data(etl::move(value))
{
}
@ -102,10 +104,12 @@ namespace etl
//*******************************************
/// Move construct from error
//*******************************************
#if ETL_CPP11_SUPPORTED
result(TError&& error)
: data(etl::move(error))
{
}
#endif
//*******************************************
/// Copy assign
@ -137,11 +141,13 @@ namespace etl
//*******************************************
/// Move assign from value
//*******************************************
#if ETL_CPP11_SUPPORTED
result& operator =(TValue&& value)
{
data = etl::move(value);
return *this;
}
#endif
//*******************************************
/// Copy assign from error
@ -155,11 +161,13 @@ namespace etl
//*******************************************
/// Move assign from error
//*******************************************
#if ETL_CPP11_SUPPORTED
result& operator =(TError&& error)
{
data = etl::move(error);
return *this;
}
#endif
//*******************************************
/// <b>true</b> if result contains a value
@ -216,10 +224,12 @@ namespace etl
/// Returns an rvalue reference to the error.
/// Undefined if the result does not contain an error.
//*******************************************
#if ETL_CPP11_SUPPORTED
TError&& error()
{
return etl::move(etl::get<TError>(data));
}
#endif
private:
@ -273,6 +283,7 @@ namespace etl
: data(etl::move(error))
{
}
#endif
//*******************************************
/// Copy assign from error
@ -291,6 +302,7 @@ namespace etl
data = etl::move(error);
return *this;
}
#endif
//*******************************************
/// <b>true</b> if result contains a value
@ -329,10 +341,12 @@ namespace etl
/// Returns an rvalue reference to the error.
/// Undefined if the result does not contain an error.
//*******************************************
#if ETL_CPP11_SUPPORTED
TError&& error()
{
return etl::move(data.value());
}
#endif
private:

View File

@ -345,9 +345,6 @@
<ClInclude Include="..\..\include\etl\io_port.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\optional.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\set.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
@ -1344,6 +1341,9 @@
<ClInclude Include="..\..\include\etl\expected.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\optional.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\test_string_char.cpp">
@ -2192,9 +2192,6 @@
<ClCompile Include="..\test_random.cpp">
<Filter>Tests\Maths</Filter>
</ClCompile>
<ClCompile Include="..\test_optional.cpp">
<Filter>Tests\Containers</Filter>
</ClCompile>
<ClCompile Include="..\test_error_handler.cpp">
<Filter>Tests\Errors</Filter>
</ClCompile>
@ -3392,6 +3389,9 @@
<ClCompile Include="..\sanity-check\to_arithmetic.h.t.cpp">
<Filter>Tests\Sanity Checks\Source</Filter>
</ClCompile>
<ClCompile Include="..\test_optional.cpp">
<Filter>Tests\Misc</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\library.properties">