MySQL 9.6.0
Source Code Documentation
mysql::meta::Is_charlike Concept Reference

true if Test, with cvref removed, is char, unsigned char, or std::byte. More...

#include <is_charlike.h>

Concept definition

template<class Test>
concept mysql::meta::Is_charlike = std::same_as<std::remove_cvref_t<Test>, char> ||
std::same_as<std::remove_cvref_t<Test>, unsigned char> ||
std::same_as<std::remove_cvref_t<Test>, std::byte>
true if Test, with cvref removed, is char, unsigned char, or std::byte.
Definition: is_charlike.h:51
unsigned char byte
Blob class.
Definition: common.h:151

Detailed Description

true if Test, with cvref removed, is char, unsigned char, or std::byte.

This is useful to define APIs that just take a raw pointer to a string, and don't care if the characters are signed or unsigned.

This is intentionally true only for these three types, and not for e.g. int8_t, because the C++ standard defines special cases for them. In particular, reinterpret_cast<T *>(...) is defined for all argument types only when T is char, unsigned char, or std::byte (http://en.cppreference.com/w/cpp/language/reinterpret_cast.html sec "Type Accessibility"; https://timsong-cpp.github.io/cppwp/n4868/basic.lval#11.3)