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

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

concept to check if a type is convertible to std::string_view More...

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

## Concept definition

template<typename T>
concept tf::StringLike = std::convertible_to<T, std::string_view>
tf::StringLike
concept to check if a type is convertible to std::string_view
Definition graph.hpp:188

## Detailed Description

concept to check if a type is convertible to std::string_view

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>);