Skip to content

Commit 4f72690

Browse files
committed
Make non-trivial element with memset in the constructor
1 parent be299e5 commit 4f72690

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

experimental/bench_hub.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ BOOST_CONTAINER_FORCEINLINE void resume_timing()
9393

9494
struct element
9595
{
96+
#if defined(NONTRIVIAL_ELEMENT)
9697
element(int n_) : n{ n_ }
97-
{}
98+
{
99+
std::memset(payload, 0, sizeof(payload));
100+
}
98101

99-
#if defined(NONTRIVIAL_ELEMENT)
100102
~element()
101103
{
102104
std::memset(payload, 0, sizeof(payload));
@@ -115,6 +117,9 @@ struct element
115117
std::memset(x.payload, 0, sizeof(payload));
116118
return *this;
117119
}
120+
#else
121+
element(int n_) : n{ n_ }
122+
{}
118123
#endif
119124

120125
operator int() const { return n; }

0 commit comments

Comments
 (0)