mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 14:04:26 +02:00
Add safety assertion
This commit is contained in:
@@ -234,6 +234,7 @@ class basic_string_base
|
|||||||
//Access and copy (to avoid UB) the first byte of the union to know if the
|
//Access and copy (to avoid UB) the first byte of the union to know if the
|
||||||
//active representation is short or long
|
//active representation is short or long
|
||||||
short_header hdr;
|
short_header hdr;
|
||||||
|
BOOST_STATIC_ASSERT((sizeof(short_header) == 1));
|
||||||
*(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr;
|
*(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr;
|
||||||
return hdr.is_short != 0;
|
return hdr.is_short != 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user