##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::char_traits::eq, std::char_traits::lt

From cppreference.com
< cpp‎ | string‎ | char traits

| (1) |
static bool eq( char_type a, char_type b ); |  | (until C++11)
static constexpr bool eq( char_type a, char_type b ); |  | (since C++11)
| (2) |
static bool lt( char_type a, char_type b ); |  | (until C++11)
static constexpr bool lt( char_type a, char_type b ); |  | (since C++11)

Compares two characters.

1) Compares `a` and `b` for equality.
2) Compares `a` and `b` in such a way that they are totally ordered.

For the `char` specialization, `eq` and `lt` are defined identically to the built-in operators `==` and `<` for type `unsigned char` (not `char`). | (since C++11)

### [edit] Parameters

a, b | - | character values to compare

### [edit] Return value

1) true if `a` and `b` are equal, false otherwise.
2) true if `a` is less than `b`, false otherwise.

### [edit] Exceptions

(none) | (until C++11)
`noexcept` specification: noexcept | (since C++11)

### [edit] Complexity

Constant.

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/string/char_traits/cmp&oldid=91495"
Category:

- unconditionally noexcept

Hidden categories:

- Pages with unreviewed unconditional noexcept template
- Pages with unreviewed noexcept template