[#boost-urls-grammar-CharSet]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/grammar.adoc[grammar]::CharSet
:relfileprefix: ../../../
:mrdocs:

Concept for a CharSet

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/grammar/charset.hpp#L115[boost&sol;url&sol;grammar&sol;charset&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class T&gt;
concept CharSet = requires (T const t, char c)
&lcub;
    &lcub; t(c) &rcub; &hyphen;&gt; std&colon;&colon;convertible&lowbar;to&lt;bool&gt;&semi;
&rcub;;
----

== Description

A `CharSet` is a unary predicate which is invocable with this equivalent signature&colon;

[,cpp]
----
bool( char ch ) const noexcept;
----
The predicate returns `true` if `ch` is a member of the set, or `false` otherwise&period;

== Exemplar

For best results, it is suggested that all constructors and member functions for character sets be marked `constexpr`&period;

[,cpp]
----
struct CharSet
{
    bool operator()( char c ) const noexcept;

    // These are both optional. If either or both are left
    // unspecified, a default implementation will be used.
    //
    char const* find_if( char const* first, char const* last ) const noexcept;
    char const* find_if_not( char const* first, char const* last ) const noexcept;
};
----
== Models

* xref:boost/urls/grammar/alnum_chars.adoc[`alnum&lowbar;chars`]
* xref:boost/urls/grammar/alpha_chars.adoc[`alpha&lowbar;chars`]
* xref:boost/urls/grammar/digit_chars.adoc[`digit&lowbar;chars`]
* xref:boost/urls/grammar/hexdig_chars.adoc[`hexdig&lowbar;chars`]
* xref:boost/urls/grammar/lut_chars.adoc[`lut&lowbar;chars`]

== See Also

xref:boost/urls/grammar/is_charset.adoc[`is&lowbar;charset`], xref:boost/urls/grammar/find_if.adoc[`find&lowbar;if`], xref:boost/urls/grammar/find_if_not.adoc[`find&lowbar;if&lowbar;not`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
