Skip to content

Commit

Permalink
Correct definition according to cppreference
Browse files Browse the repository at this point in the history
  • Loading branch information
tigran2008 committed Jul 18, 2024
1 parent a2a80da commit 8a517d5
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions include/etl/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -1393,10 +1393,10 @@ namespace etl
}

//*********************************
void reset(pointer p_) ETL_NOEXCEPT
void reset(pointer p_ = pointer()) ETL_NOEXCEPT
{
assert(p_ != p);

assert(p_ == ETL_NULLPTR || p_ != p);
pointer value = p;
p = p_;

Expand All @@ -1406,12 +1406,6 @@ namespace etl
}
}

void reset(etl::nullptr_t p_ = ETL_NULLPTR) ETL_NOEXCEPT
{
(void)p_; // unused argument
reset(pointer());
}

//*********************************
void swap(unique_ptr& value) ETL_NOEXCEPT
{
Expand Down Expand Up @@ -1615,6 +1609,11 @@ namespace etl
}
}

void reset(etl::nullptr_t = ETL_NULLPTR) ETL_NOEXCEPT
{
reset(pointer());
}

//*********************************
void swap(unique_ptr& v) ETL_NOEXCEPT
{
Expand All @@ -1629,23 +1628,13 @@ namespace etl
return (p != ETL_NULLPTR);
}

#if ETL_USING_STL && ETL_USING_CPP11
//*********************************
unique_ptr& operator =(std::nullptr_t) ETL_NOEXCEPT
{
reset(nullptr);

return *this;
}
#else
//*********************************
unique_ptr& operator =(void*) ETL_NOEXCEPT
unique_ptr& operator =(etl::nullptr_t) ETL_NOEXCEPT
{
reset(NULL);
reset(ETL_NULLPTR);

return *this;
}
#endif

#if ETL_USING_CPP11
//*********************************
Expand Down

0 comments on commit 8a517d5

Please sign in to comment.