次の方法で共有


ctype::do_narrow

A virtual function called to convert a character of type CharType used by a locale to the corresponding character of type char in the native character set.

This method is potentially unsafe, as it relies on the caller to check that the passed values are correct. Consider using ctype::_Do_narrow_s instead.

virtual char do_narrow(
    CharType _Ch, 
    char _Dfault = '\0'
) const;
virtual const CharType* do_narrow(
    const CharType* _First, 
    const CharType* _Last,
    char _Dfault, 
    char* _Dest
) const;

Parameters

  • _Ch
    The character of type Chartype used by the locale to be converted.

  • _Dfault
    The default value to be assigned by the member function to characters of type CharType that do not have counterpart characters of type char.

  • _First
    A pointer to the first character in the range of characters to be converted.

  • _Last
    A pointer to the last character in the range of characters to be converted.

  • _Dest
    A const pointer to the first character of type char in the destination range that stores the converted range of characters.

Return Value

The first protected member function returns the native character of type char that corresponds to the parameter character of type CharType or _Dfault if not counterpart is defined.

The second protected member function returns a pointer to the destination range of native characters converted from characters of type CharType.

Remarks

The second protected member template function stores in _Dest [I] the value do_narrow(_First [I], _Dfault), for I in the interval [0, _Last – _First).

注意

Any specialization of ctype that overrides this method must also override the ctype::_Do_narrow_s method.

Example

See the example for narrow, which calls do_narrow.

Requirements

Header: <locale>

Namespace: std

See Also

Concepts

ctype Class

ctype Members