Fix Variant constructors.

GitOrigin-RevId: 12942de32a8cb54b5f2fd8bc1888072c032b3025
This commit is contained in:
levlam 2019-01-14 21:04:40 +03:00
parent f54a0c3e70
commit c0815f868c

View File

@ -153,11 +153,11 @@ class Variant {
return res;
}
template <class T>
template <class T, std::enable_if_t<!std::is_same<std::decay_t<T>, Variant>::value, int> = 0>
Variant(T &&t) {
init_empty(std::forward<T>(t));
}
template <class T>
template <class T, std::enable_if_t<!std::is_same<std::decay_t<T>, Variant>::value, int> = 0>
Variant &operator=(T &&t) {
clear();
init_empty(std::forward<T>(t));
@ -287,4 +287,5 @@ template <int T, class... Types>
auto &get(const Variant<Types...> &v) {
return v.template get<T>();
}
} // namespace td