mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
enable move semantics when pushing rvalue optional
add forward_like-style cast to stack::pusher<optional<O>>
This commit is contained in:
parent
958fd037ab
commit
077448bfc8
|
@ -26,6 +26,7 @@
|
||||||
#include "raii.hpp"
|
#include "raii.hpp"
|
||||||
#include "optional.hpp"
|
#include "optional.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <type_traits>
|
||||||
#ifdef SOL_CODECVT_SUPPORT
|
#ifdef SOL_CODECVT_SUPPORT
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
@ -703,7 +704,7 @@ namespace sol {
|
||||||
if (t == nullopt) {
|
if (t == nullopt) {
|
||||||
return stack::push(L, nullopt);
|
return stack::push(L, nullopt);
|
||||||
}
|
}
|
||||||
return stack::push(L, t.value());
|
return stack::push(L, static_cast<std::conditional_t<std::is_lvalue_reference<T>::value, O&, O&&>>(t.value()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user