summaryrefslogtreecommitdiff
path: root/klm
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2014-01-27 22:06:31 -0800
committerKenneth Heafield <github@kheafield.com>2014-01-27 22:06:31 -0800
commitc2be67fa0c5f294da5ac40ca7d5db41a36a56c64 (patch)
treefc961b56d9434ffb61227ac513312889cfd17b5c /klm
parent7f69662660746eb8559bd3f041bdc4184f639fad (diff)
Fix C++11 compiler error
Diffstat (limited to 'klm')
-rw-r--r--klm/util/joint_sort.hh11
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: