summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/vecstream.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/vecstream.h')
-rw-r--r--src/lib/util/vecstream.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/lib/util/vecstream.h b/src/lib/util/vecstream.h
index fb472df95cd..bf144501253 100644
--- a/src/lib/util/vecstream.h
+++ b/src/lib/util/vecstream.h
@@ -19,6 +19,10 @@
#include <algorithm>
#include <cassert>
+#include <ios>
+#include <istream>
+#include <ostream>
+#include <memory>
#include <ostream>
#include <streambuf>
#include <string>
@@ -103,15 +107,16 @@ 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)
{
- if ((m_mode & std::ios_base::out) && (m_storage.size() < size))
+ if ((m_mode & std::ios_base::out) && (m_storage.capacity() < size))
{
m_storage.reserve(size);
adjust();
@@ -145,8 +150,8 @@ protected:
bool const out(which & std::ios_base::out);
if ((!in && !out) ||
(in && out && (std::ios_base::cur == dir)) ||
- (in && (!(m_mode & std::ios_base::in) || !this->gptr())) ||
- (out && (!(m_mode & std::ios_base::out) || !this->pptr())))
+ (in && !(m_mode & std::ios_base::in)) ||
+ (out && !(m_mode & std::ios_base::out)))
{
return pos_type(off_type(-1));
}
@@ -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__