Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
Determine the Character Type of a String
char_type_of

This customization point is an MPL metafunction which returns the character type of a given string type. char_type_of handles user-defined types such as std::string, as well as C-style strings.

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

Also, see Include Structure.

[Note] 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 char_type_of
{
    typedef <unspecified> type;
};
Template parameters

Parameter

Description

Default

T

A string type.

none

Notation

T

An arbitrary type.

N

An arbitrary integral constant.

Char

A character type.

Traits

A character traits type.

Allocator

A standard allocator type.

Expression Semantics

Expression

Semantics

char_type_of<T>::type

The character type of the string type T.

Predefined Specializations

Type

Semantics

T const

Returns char_type_of<T>.

char

Returns char.

wchar_t

Returns wchar_t.

char const*

Returns char const.

wchar_t const*

Returns wchar_t const.

char*

Returns char.

wchar_t*

Returns wchar_t.

char[N]

Returns char.

wchar_t[N]

Returns wchar_t.

char const[N]

Returns char const.

wchar_t const[N]

Returns wchar_t const.

char(&)[N]

Returns char.

wchar_t(&)[N]

Returns wchar_t.

char const(&)[N]

Returns char const.

wchar_t const(&)[N]

Returns wchar_t const.

std::basic_string<Char, Traits, Allocator>

Returns Char.

When to implement

This customization point needs to be implemented whenever traits::is_string is implemented.

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_char

For string types whose underlying character type is not char or wchar_t, is_char must be implemented.

traits::is_string

Whenever char_type_of is implemented.

traits::extract_c_string

Whenever char_type_of is implemented.


PrevUpHomeNext