summaryrefslogtreecommitdiff
path: root/secblock.h
diff options
context:
space:
mode:
Diffstat (limited to 'secblock.h')
-rw-r--r--secblock.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/secblock.h b/secblock.h
index 6797144..2b254e4 100644
--- a/secblock.h
+++ b/secblock.h
@@ -286,12 +286,28 @@ public:
memcpy(m_ptr, t.m_ptr, m_size*sizeof(T));
}
- SecBlock& operator=(const SecBlock<T, A> &t)
+ SecBlock<T, A>& operator=(const SecBlock<T, A> &t)
{
Assign(t);
return *this;
}
+ SecBlock<T, A>& operator+=(const SecBlock<T, A> &t)
+ {
+ unsigned int oldSize = m_size;
+ Grow(m_size+t.m_size);
+ memcpy(m_ptr+oldSize, t.m_ptr, t.m_size*sizeof(T));
+ return *this;
+ }
+
+ SecBlock<T, A> operator+(const SecBlock<T, A> &t)
+ {
+ SecBlock<T, A> result(m_size+t.m_size);
+ memcpy(result.m_ptr, m_ptr, m_size*sizeof(T));
+ memcpy(result.m_ptr+m_size, t.m_ptr, t.m_size*sizeof(T));
+ return result;
+ }
+
bool operator==(const SecBlock<T, A> &t) const
{
return m_size == t.m_size && memcmp(m_ptr, t.m_ptr, m_size*sizeof(T)) == 0;