Support util::function constructing from & assigning to nullptr
This commit is contained in:
parent
cae25f4719
commit
1538fa002f
1 changed files with 14 additions and 0 deletions
|
|
@ -43,11 +43,14 @@ namespace psemek::util
|
|||
|
||||
function() noexcept = default;
|
||||
|
||||
function(std::nullptr_t) noexcept;
|
||||
|
||||
template <typename F>
|
||||
function(F && f);
|
||||
|
||||
function (function &&) noexcept;
|
||||
function & operator = (function &&) noexcept;
|
||||
function & operator = (std::nullptr_t) noexcept;
|
||||
|
||||
function (function &) = delete;
|
||||
function (function const &) = delete;
|
||||
|
|
@ -99,6 +102,10 @@ namespace psemek::util
|
|||
void assign(F && f);
|
||||
};
|
||||
|
||||
template <typename R, typename ... Args>
|
||||
function<R(Args...)>::function(std::nullptr_t) noexcept
|
||||
{}
|
||||
|
||||
template <typename R, typename ... Args>
|
||||
template <typename F>
|
||||
function<R(Args...)>::function(F && f)
|
||||
|
|
@ -148,6 +155,13 @@ namespace psemek::util
|
|||
return *this;
|
||||
}
|
||||
|
||||
template <typename R, typename ... Args>
|
||||
function<R(Args...)> & function<R(Args...)>::operator = (std::nullptr_t) noexcept
|
||||
{
|
||||
reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename R, typename ... Args>
|
||||
function<R(Args...)>::~function()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue