Implement swappable concept properly

This commit is contained in:
Vas Crabb 2016-03-03 13:03:42 +11:00
parent b3a99d76e1
commit 61b531522a

View file

@ -19,6 +19,10 @@
#include <algorithm>
#include <cassert>
#include <ios>
#include <istream>
#include <ostream>
#include <memory>
#include <ostream>
#include <streambuf>
#include <string>
@ -103,10 +107,11 @@ public:
void swap(basic_vectorbuf &that)
{
using std::swap;
std::basic_streambuf<CharT, Traits>::swap(that);
std::swap(m_mode, that.m_mode);
m_storage.swap(that.m_storage);
std::swap(m_threshold, that.m_threshold);
swap(m_mode, that.m_mode);
swap(m_storage, that.m_storage);
swap(m_threshold, that.m_threshold);
}
void reserve(typename vector_type::size_type size)
@ -382,6 +387,16 @@ typedef basic_ovectorstream<wchar_t> wovectorstream;
typedef basic_vectorstream<char> vectorstream;
typedef basic_vectorstream<wchar_t> wvectorstream;
template <typename CharT, typename Traits, typename Allocator>
void swap(basic_vectorbuf<CharT, Traits, Allocator> &a, basic_vectorbuf<CharT, Traits, Allocator> &b) { a.swap(b); }
template <typename CharT, typename Traits, typename Allocator>
void swap(basic_ivectorstream<CharT, Traits, Allocator> &a, basic_ivectorstream<CharT, Traits, Allocator> &b) { a.swap(b); }
template <typename CharT, typename Traits, typename Allocator>
void swap(basic_ovectorstream<CharT, Traits, Allocator> &a, basic_ovectorstream<CharT, Traits, Allocator> &b) { a.swap(b); }
template <typename CharT, typename Traits, typename Allocator>
void swap(basic_vectorstream<CharT, Traits, Allocator> &a, basic_vectorstream<CharT, Traits, Allocator> &b) { a.swap(b); }
} // namespace util
#endif // __MAME_UTIL_VECSTREAM_H__