diff options
Diffstat (limited to 'ring.h')
-rw-r--r-- | ring.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -99,12 +99,19 @@ class ring { #if __cplusplus >= 201703L constexpr std::optional<T> take() { if (!is_empty()) { - const std::optional<T> kRet = std::move(vals[m_rc & kMASK]); + std::optional<T> ret = std::move(vals[m_rc & kMASK]); pop(); - return kRet; + return ret; } return std::nullopt; } +#else + constexpr T take() { + assert(!is_empty()); + T ret = std::move(vals[m_rc & kMASK]); + pop(); + return ret; + } #endif // -- INTERNAL --------------------------------------------------------------- |