|
Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
|
Lock-free single-producer / single-consumer ring buffer. More...
#include <spsc_ring.hpp>
Public Member Functions | |
| bool | push (T &&item) noexcept |
| Try to enqueue one element. | |
| bool | push_copy (const T &item) noexcept(std::is_nothrow_copy_constructible_v< T >) |
| Try to enqueue a copy of one element. | |
| std::optional< T > | pop () noexcept |
| Try to dequeue one element. | |
| std::size_t | size_approx () const noexcept |
| Approximate number of elements currently in the ring. | |
| bool | empty_approx () const noexcept |
| Approximate check for emptiness. | |
| bool | full_approx () const noexcept |
| Approximate check for fullness. | |
Static Public Member Functions | |
| static constexpr std::size_t | capacity () noexcept |
| Maximum number of elements the ring can hold simultaneously. | |
Lock-free single-producer / single-consumer ring buffer.
| T | Element type (noexcept move-constructible + move-assignable). |
| SIZE | Capacity; must be a power of two. |
Definition at line 85 of file spsc_ring.hpp.
|
inlinestaticconstexprnoexcept |
Maximum number of elements the ring can hold simultaneously.
Definition at line 104 of file spsc_ring.hpp.
|
inlinenoexcept |
Approximate check for emptiness.
Non-atomic snapshot — use for monitoring only.
Definition at line 199 of file spsc_ring.hpp.
|
inlinenoexcept |
Approximate check for fullness.
Non-atomic snapshot — use for monitoring only.
Definition at line 209 of file spsc_ring.hpp.
|
inlinenoexcept |
Try to dequeue one element.
Returns immediately without blocking.
Definition at line 165 of file spsc_ring.hpp.
|
inlinenoexcept |
Try to enqueue one element.
Moves item into the ring. Returns immediately without blocking.
| item | Element to enqueue (moved from). |
item is left in a moved-from state.Definition at line 122 of file spsc_ring.hpp.
|
inlinenoexcept |
Try to enqueue a copy of one element.
Convenience overload for copy-constructible types.
| item | Element to copy-enqueue. |
Definition at line 146 of file spsc_ring.hpp.
|
inlinenoexcept |
Approximate number of elements currently in the ring.
Not guaranteed to be exact under concurrent use (non-atomic snapshot of two separate atomics). Suitable for monitoring / metrics only.
Definition at line 188 of file spsc_ring.hpp.