Skip to content

Commit d805d02

Browse files
paulocoutinhoxThePhD
authored andcommitted
fix emplace
1 parent e8e122e commit d805d02

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/sol/optional_implementation.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,8 @@ namespace sol {
21912191
static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");
21922192

21932193
*this = nullopt;
2194-
this->construct(std::forward<Args>(args)...);
2194+
new (static_cast<void*>(this)) optional(std::in_place, std::forward<Args>(args)...);
2195+
return **this;
21952196
}
21962197

21972198
/// Swaps this optional with the other.

0 commit comments

Comments
 (0)