Skip to content
Snippets Groups Projects
Commit 7b80a7a4 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix set method of variant

parent b5ec46ce
No related branches found
No related tags found
No related merge requests found
......@@ -639,7 +639,7 @@ public:
template < typename T >
void set ( typename std::enable_if < ext::is_in<T, Ts...>::value && ! std::is_same < void, T >::value, T >::type && value ) {
helper_t::destroy(this->type_id, &this->data);
new (&this->data) T(value);
new ( & this->data ) T ( std::move ( value ) );
this->type_id = ext::type_index ( typeid ( T ) );
}
 
......@@ -654,7 +654,7 @@ public:
template < typename T >
void set ( const typename std::enable_if < ext::is_in<T, Ts...>::value && ! std::is_same < void, T >::value, T >::type & value ) {
helper_t::destroy(this->type_id, &this->data);
new (&this->data) T(std::move(value));
new ( & this->data ) T ( value );
this->type_id = ext::type_index ( typeid ( T ) );
}
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment