diff options
author | Kenneth Heafield <github@kheafield.com> | 2014-01-27 22:06:31 -0800 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2014-01-27 22:06:31 -0800 |
commit | c2be67fa0c5f294da5ac40ca7d5db41a36a56c64 (patch) | |
tree | fc961b56d9434ffb61227ac513312889cfd17b5c | |
parent | 7f69662660746eb8559bd3f041bdc4184f639fad (diff) |
Fix C++11 compiler error
-rw-r--r-- | klm/util/joint_sort.hh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/klm/util/joint_sort.hh b/klm/util/joint_sort.hh index 13a52b67..5589c558 100644 --- a/klm/util/joint_sort.hh +++ b/klm/util/joint_sort.hh @@ -40,6 +40,12 @@ template <class KeyIter, class ValueIter> class JointIter { swap(first.value_, second.value_); } + void DeepSwap(JointIter &other) { + using std::swap; + swap(*key_, *other.key_); + swap(*value_, *other.value_); + } + private: friend class JointProxy<KeyIter, ValueIter>; KeyIter key_; @@ -84,10 +90,7 @@ template <class KeyIter, class ValueIter> class JointProxy { } friend void swap(JointProxy<KeyIter, ValueIter> first, JointProxy<KeyIter, ValueIter> second) { - // Allow argument-dependent lookup. - using std::swap; - swap(*first.inner_.key_, *second.inner_.key_); - swap(*first.inner_.value_, *second.inner_.value_); + first.DeepSwap(second); } private: |