Skip to content

Commit

Permalink
Make it more clear that assignment is from etl::unexpected
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitmark committed Jul 16, 2023
1 parent a73d356 commit b8ceac4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions include/etl/expected.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,25 +450,25 @@ namespace etl
#endif

//*******************************************
/// Copy assign from error
/// Copy assign from unexpected
//*******************************************
expected& operator =(const unexpected_type& error)
expected& operator =(const unexpected_type& ue)
{
ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");

storage.template emplace<Error_Type>(error.error());
storage.template emplace<Error_Type>(ue.error());
return *this;
}

#if ETL_USING_CPP11
//*******************************************
/// Move assign from error
/// Move assign from unexpected
//*******************************************
expected& operator =(unexpected_type&& error)
expected& operator =(unexpected_type&& ue)
{
ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");

storage.template emplace<Error_Type>(etl::move(error.error()));
storage.template emplace<Error_Type>(etl::move(ue.error()));
return *this;
}
#endif
Expand Down Expand Up @@ -830,25 +830,25 @@ namespace etl
#endif

//*******************************************
/// Copy assign from error
/// Copy assign from unexpected
//*******************************************
expected& operator =(const unexpected_type& error)
expected& operator =(const unexpected_type& ue)
{
ETL_STATIC_ASSERT(etl::is_copy_constructible<TError>::value, "Error not copy assignable");

storage.template emplace<Error_Type>(error.error());
storage.template emplace<Error_Type>(ue.error());
return *this;
}

#if ETL_USING_CPP11
//*******************************************
/// Move assign from error
/// Move assign from unexpected
//*******************************************
expected& operator =(unexpected_type&& error)
expected& operator =(unexpected_type&& ue)
{
ETL_STATIC_ASSERT(etl::is_move_constructible<TError>::value, "Error not move assignable");

storage.template emplace<Error_Type>(etl::move(error.error()));
storage.template emplace<Error_Type>(etl::move(ue.error()));
return *this;
}
#endif
Expand Down

0 comments on commit b8ceac4

Please sign in to comment.