libstdc++: __gnu_cxx::char_traits< _CharT > Struct Template Reference

libstdc++

__gnu_cxx::char_traits< _CharT > Struct Template Reference

`#include <char_traits.h>`

Inheritance diagram for __gnu_cxx::char_traits< _CharT >:
[legend]

## Public Types
typedef _CharT | char_type
using | comparison_category
typedef _Char_types< _CharT >::int_type | int_type
typedef _Char_types< _CharT >::off_type | off_type
typedef _Char_types< _CharT >::pos_type | pos_type
typedef _Char_types< _CharT >::state_type | state_type

## Static Public Member Functions
static constexpr void | assign (char_type &__c1, const char_type &__c2)
static constexpr char_type * | assign (char_type *__s, std::size_t __n, char_type __a)
static constexpr int | compare (const char_type *__s1, const char_type *__s2, std::size_t __n)
static constexpr char_type * | copy (char_type *__s1, const char_type *__s2, std::size_t __n)
static constexpr int_type | eof ()
static constexpr bool | eq (const char_type &__c1, const char_type &__c2)
static constexpr bool | eq_int_type (const int_type &__c1, const int_type &__c2)
static constexpr const char_type * | find (const char_type *__s, std::size_t __n, const char_type &__a)
static constexpr std::size_t | length (const char_type *__s)
static constexpr bool | lt (const char_type &__c1, const char_type &__c2)
static constexpr char_type * | move (char_type *__s1, const char_type *__s2, std::size_t __n)
static constexpr int_type | not_eof (const int_type &__c)
static constexpr char_type | to_char_type (const int_type &__c)
static constexpr int_type | to_int_type (const char_type &__c)

## Detailed Description

template<typename _CharT>
struct __gnu_cxx::char_traits< _CharT >

Base class used to implement std::char_traits.

Note
  For any given actual character type, this definition is probably wrong. (Most of the member functions are likely to be right, but the int_type and state_type typedefs, and the eof() member function, are likely to be wrong.) The reason this class exists is so users can specialize it. Classes in namespace std may not be specialized for fundamental types, but classes in namespace __gnu_cxx may be.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types for advice on how to make use of this class for unusual character types. Also, check out include/ext/pod_char_traits.h.

Definition at line 113 of file char_traits.h.

## Member Typedef Documentation

## ◆ char_type

template<typename _CharT>

typedef _CharT __gnu_cxx::char_traits< _CharT >::char_type

Definition at line 115 of file char_traits.h.

## ◆ comparison_category

template<typename _CharT>

using __gnu_cxx::char_traits< _CharT >::comparison_category

Definition at line 123 of file char_traits.h.

## ◆ int_type

template<typename _CharT>

typedef _Char_types<_CharT>::int_type __gnu_cxx::char_traits< _CharT >::int_type

Definition at line 116 of file char_traits.h.

## ◆ off_type

template<typename _CharT>

typedef _Char_types<_CharT>::off_type __gnu_cxx::char_traits< _CharT >::off_type

Definition at line 119 of file char_traits.h.

## ◆ pos_type

template<typename _CharT>

typedef _Char_types<_CharT>::pos_type __gnu_cxx::char_traits< _CharT >::pos_type

Definition at line 118 of file char_traits.h.

## ◆ state_type

template<typename _CharT>

typedef _Char_types<_CharT>::state_type __gnu_cxx::char_traits< _CharT >::state_type

Definition at line 120 of file char_traits.h.

## Member Function Documentation

## ◆ assign() [1/2]

template<typename _CharT>

constexpr void __gnu_cxx::char_traits< _CharT >::assign | ( | char_type & | __c1,
|  | const char_type & | __c2 )
| inlinestaticconstexpr

Definition at line 127 of file char_traits.h.

## ◆ assign() [2/2]

template<typename _CharT>

char_traits< _CharT >::char_type * __gnu_cxx::char_traits< _CharT >::assign | ( | char_type * | __s,
|  | std::size_t | __n,
|  | char_type | __a )
| staticconstexpr

Definition at line 275 of file char_traits.h.

## ◆ compare()

template<typename _CharT>

int __gnu_cxx::char_traits< _CharT >::compare | ( | const char_type * | __s1,
|  | const char_type * | __s2,
|  | std::size_t | __n )
| staticconstexpr

Definition at line 188 of file char_traits.h.

## ◆ copy()

template<typename _CharT>

char_traits< _CharT >::char_type * __gnu_cxx::char_traits< _CharT >::copy | ( | char_type * | __s1,
|  | const char_type * | __s2,
|  | std::size_t | __n )
| staticconstexpr

Definition at line 255 of file char_traits.h.

## ◆ eof()

template<typename _CharT>

constexpr int_type __gnu_cxx::char_traits< _CharT >::eof | ( |  | ) |
| inlinestaticconstexpr

Definition at line 177 of file char_traits.h.

## ◆ eq()

template<typename _CharT>

constexpr bool __gnu_cxx::char_traits< _CharT >::eq | ( | const char_type & | __c1,
|  | const char_type & | __c2 )
| inlinestaticconstexpr

Definition at line 138 of file char_traits.h.

## ◆ eq_int_type()

template<typename _CharT>

constexpr bool __gnu_cxx::char_traits< _CharT >::eq_int_type | ( | const int_type & | __c1,
|  | const int_type & | __c2 )
| inlinestaticconstexpr

Definition at line 172 of file char_traits.h.

## ◆ find()

template<typename _CharT>

const char_traits< _CharT >::char_type * __gnu_cxx::char_traits< _CharT >::find | ( | const char_type * | __s,
|  | std::size_t | __n,
|  | const char_type & | __a )
| staticconstexpr

Definition at line 212 of file char_traits.h.

## ◆ length()

template<typename _CharT>

std::size_t __gnu_cxx::char_traits< _CharT >::length | ( | const char_type * | __s | ) |
| staticconstexpr

Definition at line 201 of file char_traits.h.

## ◆ lt()

template<typename _CharT>

constexpr bool __gnu_cxx::char_traits< _CharT >::lt | ( | const char_type & | __c1,
|  | const char_type & | __c2 )
| inlinestaticconstexpr

Definition at line 142 of file char_traits.h.

## ◆ move()

template<typename _CharT>

char_traits< _CharT >::char_type * __gnu_cxx::char_traits< _CharT >::move | ( | char_type * | __s1,
|  | const char_type * | __s2,
|  | std::size_t | __n )
| staticconstexpr

Definition at line 224 of file char_traits.h.

## ◆ not_eof()

template<typename _CharT>

constexpr int_type __gnu_cxx::char_traits< _CharT >::not_eof | ( | const int_type & | __c | ) |
| inlinestaticconstexpr

Definition at line 181 of file char_traits.h.

## ◆ to_char_type()

template<typename _CharT>

constexpr char_type __gnu_cxx::char_traits< _CharT >::to_char_type | ( | const int_type & | __c | ) |
| inlinestaticconstexpr

Definition at line 164 of file char_traits.h.

## ◆ to_int_type()

template<typename _CharT>

constexpr int_type __gnu_cxx::char_traits< _CharT >::to_int_type | ( | const char_type & | __c | ) |
| inlinestaticconstexpr

Definition at line 168 of file char_traits.h.

The documentation for this struct was generated from the following file:

- char_traits.h