Sam Jaffe пре 5 година
родитељ
комит
28249d17fb
1 измењених фајлова са 4 додато и 9 уклоњено
  1. 4 9
      variant.hpp

+ 4 - 9
variant.hpp

@@ -111,28 +111,23 @@ public:
     set<T>(value);
   }
   
-  variant(const variant<Ts...>& old) : type_id(old.type_id), data()
-  {
+  variant(const variant<Ts...>& old) : type_id(old.type_id), data() {
     helper_t::copy(num_types - type_id - 1, &old.data, &data);
   }
   
-  variant(variant<Ts...>&& old) : type_id(old.type_id), data()
-  {
+  variant(variant&& old) : type_id(old.type_id), data() {
     helper_t::move(num_types - type_id - 1, &old.data, &data);
     old.type_id = invalid_type();
   }
   
-  // Serves as both the move and the copy asignment operator.
-  variant<Ts...>& operator= (variant<Ts...> const &old)
-  {
+  variant& operator=(variant const & old) {
     helper_t::destroy(num_types - type_id - 1, &data);
     type_id = old.type_id;
     helper_t::copy(num_types - type_id - 1, &old.data, &data);
     return *this;
   }
 
-  variant<Ts...>& operator= (variant<Ts...> &&old)
-  {
+  variant& operator=(variant&& old) {
     helper_t::destroy(num_types - type_id - 1, &data);
     type_id = old.type_id;
     helper_t::move(num_types - type_id - 1, &old.data, &data);