Assert on type size invariant

This commit is contained in:
Vinnie Falco
2013-07-15 16:40:10 -07:00
parent 0008193a20
commit e2fd51c282
2 changed files with 4 additions and 2 deletions

View File

@@ -2,6 +2,8 @@
BEAST TODO
--------------------------------------------------------------------------------
- Rename HeapBlock routines to not conflict with _CRTDBG_MAP_ALLOC macros
- Design a WeakPtr / SharedPtr / SharedObject intrusive system
- Implement beast::Bimap?

View File

@@ -76,10 +76,10 @@ public:
template <class IntegerType>
UnsignedInteger <Bytes>& operator= (IntegerType value)
{
static_bassert (sizeof (Bytes) >= sizeof (IntegerType));
static_bassert (Bytes >= sizeof (IntegerType));
clear ();
value = ByteOrder::swapIfLittleEndian (value);
memcpy (end () - sizeof (value), &value, sizeof (value));
memcpy (end () - sizeof (value), &value, bmin (Bytes, sizeof (value)));
return *this;
}