docs/concepttf_1_1GraphLike.html
| | Taskflow: A General-purpose Task-parallel Programming System |
Loading...
Searching...
No Matches
tf::GraphLike Concept Reference
concept that determines if a type owns or provides access to a tf::GraphMore...
#include <taskflow/core/graph.hpp>
template<typename T>
concept tf::GraphLike = std::derived_from<T, Graph> ||
requires(T& t) {
{ t.graph() } -> std::convertible_to<Graph&>;
}
concept that determines if a type owns or provides access to a tf::Graph
Definition graph.hpp:1028
concept that determines if a type owns or provides access to a tf::Graph
A type satisfies tf::GraphLike if it meets one of the following two criteria:
tf::Graph.graph() method that returns a reference convertible to tf::Graph&.This concept is used by tf::retrieve_graph to abstract the way graphs are accessed across different taskflow components.
// Satisfies via inheritance
struct CustomGraph1 : public tf::Graph {};
static_assert(tf::GraphLike<CustomGraph1>);
// Satisfies via composition
struct CustomGraph2 {
tf::Graph& graph() { return _g; }
tf::Graph _g;
};
static_assert(tf::GraphLike<CustomGraph2>);
// Fails: does not meet inheritance or method requirements
struct InvalidType {
void handle() {}
};
static_assert(! tf::GraphLike<InvalidType>);
class to create a graph object
Definition graph.hpp:47