Closed bansalnvn closed 6 years ago
iirc this isn't possible, without enable_if
tricks, as the static assertion will fire when class is instantiated, not when the class is used. if you find a way, which is not completely ugly, i'm happy to merge a PR, though ...
Yeah, I think currently std::enable_if
or the if constexpr
is needed. I will close the ticket for now. Thanks.
For the record, this is the commit that changed BOOST_STATIC_ASSERT()
to BOOST_ASSERT()
back in 2012: 505c1c04c18939cfd8fbf58386230ee78f4549ad
https://github.com/boostorg/lockfree/blob/ffd91db4589fda2e5f843d0773dc3325baea88e0/include/boost/lockfree/queue.hpp#L188
This check for construction of the queue, if the capacity has been specified as the template parameter should be moved to static assert rather than having the run time assert.