diff options
author | Xiang Li <lixiang.ict@gmail.com> | 2013-05-17 05:04:47 +0400 |
---|---|---|
committer | Xiang Li <lixiang.ict@gmail.com> | 2013-05-17 05:04:47 +0400 |
commit | 4cbca043311114b6007159faa71b7b5936237aa0 (patch) | |
tree | 941ac20a453c33b2593596d39c525e9e445fb451 /util | |
parent | ce516b770c04f281f643d03edc1a357b4d139295 (diff) |
Swap for sized iterator
Diffstat (limited to 'util')
-rw-r--r-- | util/sized_iterator.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/sized_iterator.hh b/util/sized_iterator.hh index aabcc5319..cd0b187a9 100644 --- a/util/sized_iterator.hh +++ b/util/sized_iterator.hh @@ -62,6 +62,13 @@ class SizedProxy { const void *Data() const { return inner_.Data(); } void *Data() { return inner_.Data(); } + + friend void swap(SizedProxy &first, SizedProxy &second) { + std::swap_ranges( + static_cast<char*>(first.inner_.Data()), + static_cast<char*>(first.inner_.Data()) + first.inner_.EntrySize(), + static_cast<char*>(second.inner_.Data())); + } private: friend class util::ProxyIterator<SizedProxy>; |