Aller au contenu
Bienvenue sur la nouvelle documentation de CppUtils !

Namespace: CppUtils::String

template<class T>
concept CharacterPointerOrArray = (std::is_pointer_v<std::decay_t<T>> or std::is_array_v<std::remove_cvref_t<T>>) and Type::Character<CppUtils::Type::UnderlyingElementType<T>>;

Concept satisfied if T is a raw pointer or array of character types.

template<class T, class CharT char>
concept CharacterSequence = Text<T, CharT> or requires (const T& target) { { std::span<const CharT>{target} }; };

Concept satisfied by types representing contiguous character sequences (strings, string views, or spans of characters).

template<class T>
concept DirectlyPrintable = (std::formattable<std::remove_cvref_t<T>, char> or std::same_as<std::remove_cvref_t<T>, std::byte>) and (not std::ranges::input_range<std::remove_cvref_t<T>> or GenericText<std::remove_cvref_t<T>> or std::same_as<std::remove_cvref_t<T>, std::filesystem::path>);

Concept satisfied if T is directly formattable as text without structural decomposition.

template<class T>
concept ExtensivelyPrintable = isExtensivelyPrintable<T>();

Concept satisfied if T can be formatted directly or through recursive decomposition.

template<class T>
concept Formattable = std::formattable<std::remove_cvref_t<T>, char>;
template<class T>
concept GenericText = Text<T, char, char8_t, char16_t, char32_t, wchar_t>;
template<class T>
concept String = Type::Specializes<T, std::basic_string>;
template<class T>
concept StringView = Type::Specializes<T, std::basic_string_view>;
template<class T, class... Chars>
concept Text = (std::is_convertible_v<std::remove_cvref_t<T>, std::basic_string_view<Chars>> or ...);