---
name: "__gnu_cxx::char_traits"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_cxx::char_traits"
---

# \_\_gnu\_cxx::char\_traits(3)

Base class used to implement std::char\_traits.

## NAME

\_\_gnu\_cxx::char\_traits\< \_CharT \> - Base class used to implement std::char\_traits.

## SYNOPSIS

\#include \<char\_traits.h\>

Inherited by **std::int\_type\< char \>**, **std::pos\_type\< char \>**, **std::off\_type\< char \>**, **std::char\_traits\< \_\_gnu\_cxx::character\< \_Value, \_Int, \_St \> \>**, **std::char\_traits\< char \>**, std::char\_traits\< char16\_t \>, std::char\_traits\< char32\_t \>, **std::char\_traits\< wchar\_t \>**, and **std::char\_traits\< \_CharT \>**.

### 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.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
