From 1712f0a33b2eda4c8ac7a1b4ed2b55acd61cfadf Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 9 Jan 2013 18:43:32 -0800 Subject: [PATCH] Add goodies Signed-off-by: Leonardo de Moura --- src/util/buffer.h | 9 +++++++-- src/util/util.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/util/buffer.h b/src/util/buffer.h index 1467e64df..55ab43ec3 100644 --- a/src/util/buffer.h +++ b/src/util/buffer.h @@ -231,8 +231,13 @@ public: SASSERT(size() == nsz); } -private: - buffer& operator=(buffer const&); + buffer & operator=(buffer const & other) { + if (this == &other) + return *this; + reset(); + append(other); + return *this; + } }; template diff --git a/src/util/util.h b/src/util/util.h index 945d259f9..3360c2282 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -243,6 +243,10 @@ public: m_ptr = 0; return tmp; } + + void swap(scoped_ptr & p) { + std::swap(m_ptr, p.m_ptr); + } }; template