| 25 | // to avoid deadlocks, see `ThreadSafeQueue.h` for details. |
| 26 | template <typename Queue> |
| 27 | auto makePush(Queue& queue) { |
| 28 | return [&queue](size_t i) { |
| 29 | if constexpr (ad_utility::similarToInstantiation<Queue, ThreadSafeQueue>) { |
| 30 | return queue.push(i); |
| 31 | } else { |
| 32 | return queue.push(i, i); |
| 33 | } |
| 34 | }; |
| 35 | } |
| 36 | |
| 37 | // Similar to `makePush` above, but the returned lambda doesn't push directly to |
| 38 | // the queue, but simply returns a value that can then be pushed to the queue. |