Skip to content

Commit 61cfb31

Browse files
committed
Update README with range-based API details
Added references to std::ranges and the new range-based API in the documentation. Provided a tip directing users to the examples section for more information on the range-based API, which abstracts away the two-block nature of the circular buffer.
1 parent 487827f commit 61cfb31

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This project provides a robust, tested, lock-free queue that is suitable for hig
1212

1313
- **Lock-Free:** Uses `std::atomic` with correct memory ordering to ensure thread safety without mutexes, preventing deadlocks and priority inversion issues.
1414
- **Single-Producer, Single-Consumer (SPSC):** Optimized for the common two-thread communication pattern.
15-
- **Modern C++:** Uses modern features like `std::span`.
15+
- **Modern C++:** Uses modern features like `std::span` and `std::ranges`.
1616
- **Header-Only:** The queue is provided as a single header file without any external dependences for easy integration.
1717
- **Move Semantics Friendly:** The API design grants direct access to the buffer slots via `std::span` (in the `Scope` objects) and lambda arguments (in the `try_write`/`try_read` methods). This allows users to `std::move` objects into and out of the queue, providing a significant performance advantage over pointer-based APIs (which imply `memcpy`-style copies) when working with non-trivially-copyable types like `std::string`, `std::vector`, or `std::unique_ptr`.
1818
- **Cache-Friendly:** The queue is optimized for multi-core performance.
@@ -62,6 +62,10 @@ Note: If there is no need to split the read or write operation into two chunks,
6262

6363
## Example Use
6464

65+
> [!TIP]
66+
> Please refer to the "[Examples](examples/README.md)" section to explore more API options, including the
67+
> new [Range-Based API](examples/README.md##4-range-based-api-stdranges), which completely abstracs away the two-block nature of the circular buffer.
68+
6569
Here is a complete, minimal example demonstrating the recommended batch-oriented usage. A producer thread sends several small batches of integers, and a consumer thread reads them as they become available.
6670

6771
```cpp

0 commit comments

Comments
 (0)