[locale.ctype.virtuals]

# 28 Text processing library [[text]](./#text)

## 28.3 Localization library [[localization]](localization#locale.ctype.virtuals)

### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.ctype.virtuals)

#### 28.3.4.2 The ctype category [[category.ctype]](category.ctype#locale.ctype.virtuals)

#### 28.3.4.2.2 Class template ctype [[locale.ctype]](locale.ctype#virtuals)

#### 28.3.4.2.2.3 ctype virtual functions [locale.ctype.virtuals]

[ð](#lib:ctype,do_is)

`bool         do_is(mask m, charT c) const;
const charT* do_is(const charT* low, const charT* high, mask* vec) const;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1500)

*Effects*: Classifies a character or sequence of characters[.](#1.sentence-1)

For each argument character,
identifies a value M of type ctype_base​::​mask[.](#1.sentence-2)

The second form identifies a value M of type ctype_base​::​mask for each *p where (low <= p && p < high),
and places it into vec[p - low][.](#1.sentence-3)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1509)

*Returns*: The first form returns the result of the expression (M & m) != 0;
i.e., true if the character has the characteristics specified[.](#2.sentence-1)

The second form returns high[.](#2.sentence-2)

[ð](#lib:ctype_base,do_scan_is)

`const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1522)

*Effects*: Locates a character in a buffer that conforms to a classification m[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1526)

*Returns*: The smallest pointer p in the range [low, high)
such that is(m, *p) would return true;
otherwise, returns high[.](#4.sentence-1)

[ð](#lib:ctype,do_scan_not)

`const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1539)

*Effects*: Locates a character in a buffer that fails to conform to a classificationm[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1544)

*Returns*: The smallest pointer p, if any, in the range [low, high)
such that is(m, *p) would return false;
otherwise, returns high[.](#6.sentence-1)

[ð](#lib:ctype,do_toupper)

`charT        do_toupper(charT c) const;
const charT* do_toupper(charT* low, const charT* high) const;
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1558)

*Effects*: Converts a character or characters to upper case[.](#7.sentence-1)

The second form replaces
each character *p in the range [low, high)
for which a corresponding upper-case character exists,
with that character[.](#7.sentence-2)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1566)

*Returns*: The first form returns
the corresponding upper-case character if it is known to exist, or
its argument if not[.](#8.sentence-1)

The second form returns high[.](#8.sentence-2)

[ð](#lib:ctype,do_tolower)

`charT        do_tolower(charT c) const;
const charT* do_tolower(charT* low, const charT* high) const;
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1581)

*Effects*: Converts a character or characters to lower case[.](#9.sentence-1)

The second form replaces
each character *p in the range [low, high)
and for which a corresponding lower-case character exists,
with that character[.](#9.sentence-2)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1589)

*Returns*: The first form returns
the corresponding lower-case character if it is known to exist, or
its argument if not[.](#10.sentence-1)

The second form returns high[.](#10.sentence-2)

[ð](#lib:ctype,do_widen)

`charT        do_widen(char c) const;
const char*  do_widen(const char* low, const char* high, charT* dest) const;
`

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1604)

*Effects*: Applies the simplest reasonable transformation
from a char value or sequence of char values
to the corresponding charT value or values[.](#11.sentence-1)[217](#footnote-217 "The parameter c of do_­widen is intended to accept values derived from character-literals for conversion to the locale's encoding.")

The only characters for which unique transformations are required
are those in the basic character set ([[lex.charset]](lex.charset "5.3.1 Character sets"))[.](#11.sentence-2)

For any named ctype category with
a ctype<char> facet ctc and
valid ctype_base​::​mask value M,(ctc.​is(M, c) || !is(M, do_widen(c)) ) is true[.](#11.sentence-3)[218](#footnote-218 "In other words, the transformed character is not a member of any character classification that c is not also a member of.")

The second form transforms
each character *p in the range [low, high),
placing the result in dest[p - low][.](#11.sentence-4)

[12](#12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1631)

*Returns*: The first form returns the transformed value[.](#12.sentence-1)

The second form returns high[.](#12.sentence-2)

[ð](#lib:ctype,do_narrow)

`char         do_narrow(charT c, char dfault) const;
const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const;
`

[13](#13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1644)

*Effects*: Applies the simplest reasonable transformation
from a charT value or sequence of charT values
to the corresponding char value or values[.](#13.sentence-1)

For any character c in the basic character set ([[lex.charset]](lex.charset "5.3.1 Character sets"))
the transformation is such thatdo_widen(do_narrow(c, 0)) == c

For any named ctype category with
a ctype<char> facet ctc however, andctype_base​::​mask value M,(is(M, c) || !ctc.is(M, do_narrow(c, dfault)) ) is true (unless do_narrow returns dfault)[.](#13.sentence-3)

In addition, for any digit character c,
the expression (do_narrow(c, dfault) - '0') evaluates to the digit value of the character[.](#13.sentence-4)

The second form transforms
each character *p in the range [low, high),
placing the result
(or dfault if no simple transformation is readily available)
in dest[p - low][.](#13.sentence-5)

[14](#14)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L1672)

*Returns*: The first form returns the transformed value;
or dfault if no mapping is readily available[.](#14.sentence-1)

The second form returns high[.](#14.sentence-2)

[217)](#footnote-217)[217)](#footnoteref-217)

The parameter c of do_widen is intended to
accept values derived from [*character-literal*](lex.ccon#nt:character-literal "5.13.3 Character literals [lex.ccon]")*s* for conversion to the locale's encoding[.](#footnote-217.sentence-1)

[218)](#footnote-218)[218)](#footnoteref-218)

In other words, the transformed character is not
a member of any character classification
that c is not also a member of[.](#footnote-218.sentence-1)
