| 317 | } |
| 318 | |
| 319 | auto pop() noexcept { |
| 320 | unsigned tail; |
| 321 | if(Derived::spsc_) { |
| 322 | tail = tail_.load(X); |
| 323 | tail_.store(tail + 1, X); |
| 324 | } |
| 325 | else { |
| 326 | constexpr auto memory_order = Derived::total_order_ ? std::memory_order_seq_cst : std::memory_order_relaxed; |
| 327 | tail = tail_.fetch_add(1, memory_order); // FIFO and total order on Intel regardless, as of 2019. |
| 328 | } |
| 329 | return static_cast<Derived&>(*this).do_pop(tail); |
| 330 | } |
| 331 | |
| 332 | bool was_empty() const noexcept { |
| 333 | return !was_size(); |