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

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

concept that determines if a type is string-like More...

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

## Concept definition

template<typename T>
concept tf::StringLike = std::convertible_to<T, std::string_view>
tf::StringLike
concept that determines if a type is string-like
Definition graph.hpp:162

## Detailed Description

concept that determines if a type is string-like

A type satisfies tf::StringLike if it is convertible to std::string_view, including:

- std::string
- std::string_view
- const char*
- any type that provides an implicit conversion to std::string_view

static_assert(tf::StringLike<std::string>);
static_assert(tf::StringLike<std::string_view>);
static_assert(tf::StringLike<const char*>);
// custom type with implicit conversion
struct MyString {
operator std::string_view() const { return _data; }
std::string _data;
};
static_assert(tf::StringLike<MyString>);