public member function
<locale>

std::ctype::scan_not

const char_type* scan_not (mask m, const char_type* low, const char_type* high) const;
Return first character not in category
Returns the first character in the range [low,high) that does not classify into any of the categories specified in m. If no such character is found in the range, high is returned.

In ctype's generic template, this function simply calls the virtual protected member do_scan_not, which does the above by default.

In the char specialization (ctype<char>), this function uses the internal table to directly return the results without calling any virtual member.

Parameters

m
Bitmask of member type mask (inherited from ctype_base) specifying the categories to scan for. If the bitmask combines more than one category, the function returns a pointer to the first character that does not belong to any of the categories.
It may be any bitwise combination of the following member bitmask values:
member constantvaluedescription
spaceunspecified (unique bits)white-space character
printunspecified (unique bits)printable character
cntrlunspecified (unique bits)control character
upperunspecified (unique bits)uppercase letter
lowerunspecified (unique bits)lowercase letter
alphaunspecified (unique bits)alphabetic character
digitunspecified (unique bits)decimal digit
punctunspecified (unique bits)punctuation character
xdigitunspecified (unique bits)hexadecimal digit
alnumalpha|digitalpha-numeric character
graphalnum|punctcharacter with graphic representation
member constantvaluedescription
spaceunspecified (unique bits)white-space character
printunspecified (unique bits)printable character
cntrlunspecified (unique bits)control character
upperunspecified (unique bits)uppercase letter
lowerunspecified (unique bits)lowercase letter
alphaunspecified (unique bits)alphabetic character
digitunspecified (unique bits)decimal digit
punctunspecified (unique bits)punctuation character
xdigitunspecified (unique bits)hexadecimal digit
blankunspecified (unique bits)blank character
alnumalpha|digitalpha-numeric character
graphalnum|punctcharacter with graphic representation
See <cctype> for details on how ASCII characters are classified with respect to these categories.
low, high
Pointer to the beginning and end of the sequence of characters. The range used is [low,high), which contains all the characters between low and high, including the character pointed by low but not the character pointed by high.
Note that null characters are also considered, and the function may proceed beyond them, until a match is found or the entire range is completed.
Member type char_type is the facet's character type (defined as an alias of ctype's template parameter, charT).

Return value

A pointer to the first element in the range that does not classify, or high if none is found.
Member type char_type is the facet's character type (defined as an alias of ctype's template parameter, charT).

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// ctype::scan_not example
#include <iostream>       // std::cout
#include <locale>         // std::locale, std::ctype, std::use_facet

int main ()
{
  std::locale loc;

  const char period[] = "November2008";

  const char * p = std::use_facet< std::ctype<char> >(loc).scan_not ( std::ctype<char>::alpha, period, period+12 );

  std::cout << "The first non-alphabetic character is: " << *p << '\n';

  return 0;
}


Output:

The first non-alphabetic character is: 2.

Data races

The object, and the elements in the range [low,high), are accessed.

Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the object.

See also