| Taskflow: A General-purpose Task-parallel Programming System

Loading...
Searching...
No Matches
tf::BoundedWSQLike Concept Reference

concept to check if a type supports bounded work-stealing queue operations More...

`#include <taskflow/core/wsq.hpp>`

## Concept definition

template<typename Q>
concept tf::BoundedWSQLike = requires(Q& q, typename Q::value_type v) {
{ q.steal() };
{ q.pop() };
{ q.try_push(v) } -> std::same_as<bool>;
}
tf::BoundedWSQLike
concept to check if a type supports bounded work-stealing queue operations
Definition wsq.hpp:918

## Detailed Description

concept to check if a type supports bounded work-stealing queue operations

A type `Q` satisfies `BoundedWSQLike` if it exposes the three core operations required by a bounded work-stealing queue: owner-side pop, thief-side steal, and a fallible owner-side push.

Requirements

- `Q::value_type` must be defined
- `q.pop()` must be valid
- `q.steal()` must be valid
- `q.try_push(v)` must return `bool`

Examples

// BoundedWSQ satisfies BoundedWSQLike
static_assert(tf::BoundedWSQLike<tf::BoundedWSQ<int*>>);
// Custom queue type that satisfies the concept
struct MyQueue {
using value_type = int*;
value_type pop() { return nullptr; }
value_type steal() { return nullptr; }
bool try_push(value_type) { return true; }
};
static_assert(tf::BoundedWSQLike<MyQueue>);