| Home | Libraries | People | FAQ | More

##### Determine if a Type is a Character

###### is_char

`is_char` is a metafunction that detects if a given type is a character.

###### Module Headers

    #include <boost/spirit/home/support/string_traits.hpp>

Also, see Include Structure.

| Note
This header file does not need to be included directly by any user program as it is normally included by other Spirit header files relying on its content.

###### Namespace

Name
`boost::spirit::traits`

###### Synopsis

    template <typename T>
    struct is_char
    {
        <unspecified>;
    };

###### Template parameters

Parameter | Description | Default
--- | --- | ---
`T` | The type to detect. | none

Notation

`T`

  An arbitrary type

###### Expression Semantics

Expression | Semantics
--- | ---
`is_char<T>::type` | `mpl::true_` if T should be treated as a character type, and `mpl::false_` otherwise. Generally, any implementation of `is_char` needs to behave as if if was a MPL Boolean Constant.

###### Predefined Specializations

Type | Semantics
--- | ---
`T` | `mpl::false_`
`T const` | `is_char<T>`
`char` | `mpl::true_`
`wchar_t` | `mpl::true_`

###### When to implement

This customization point needs to be implemented for any strings that use a type other than `char` or `wchar_t to store character data.

###### Related Attribute Customization Points

If this customization point is implemented, the following other customization points need to be implemented as well.

Name | When to implement
--- | ---
`traits::is_string` | Whenever `is_char` is implemented.
`traits::char_type_of` | Whenever `is_char` is implemented.