mirror of
https://github.com/boostorg/container.git
synced 2026-07-05 11:30:46 +02:00
Make non-trivial element with memset in the constructor
This commit is contained in:
@@ -93,10 +93,12 @@ BOOST_CONTAINER_FORCEINLINE void resume_timing()
|
||||
|
||||
struct element
|
||||
{
|
||||
element(int n_) : n{ n_ }
|
||||
{}
|
||||
|
||||
#if defined(NONTRIVIAL_ELEMENT)
|
||||
element(int n_) : n{ n_ }
|
||||
{
|
||||
std::memset(payload, 0, sizeof(payload));
|
||||
}
|
||||
|
||||
~element()
|
||||
{
|
||||
std::memset(payload, 0, sizeof(payload));
|
||||
@@ -115,6 +117,9 @@ struct element
|
||||
std::memset(x.payload, 0, sizeof(payload));
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
element(int n_) : n{ n_ }
|
||||
{}
|
||||
#endif
|
||||
|
||||
operator int() const { return n; }
|
||||
|
||||
Reference in New Issue
Block a user