Browse Source

Extract swap to trie_impl.hpp, since it d/n depend on private members of trie_iterator.

Samuel Jaffe 8 years ago
parent
commit
25580fe76d
2 changed files with 9 additions and 5 deletions
  1. 2 5
      trie.hpp
  2. 7 0
      trie_impl.hpp

+ 2 - 5
trie.hpp

@@ -171,11 +171,8 @@ private:
     }
     return it1 == end1 && it2 == end2;
   }
-  friend void swap(trie & lhs, trie & rhs) {
-    using std::swap;
-    swap(lhs.value_, rhs.value_);
-    swap(lhs.impl_, rhs.impl_);
-  }
+  
+  friend void swap(trie & lhs, trie & rhs);
   
   mapped_type value_{};
   backing_t impl_{};

+ 7 - 0
trie_impl.hpp

@@ -112,3 +112,10 @@ namespace detail {
     return rval;
   }
 }
+
+template <typename K, typename V, typename C>
+void swap(trie<K, V, C> & lhs, trie<K, V, C> & rhs) {
+  using std::swap;
+  swap(lhs.value_, rhs.value_);
+  swap(lhs.impl_, rhs.impl_);
+}