CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 30 Jul 2025 21:52:23 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/locale/ctype/widen/
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 30 Jul 2025 21:52:23 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"9271-hGcSMm+XLC8VJMRBDsVBfWqS1D4"
Content-Encoding: gzip
The first version (1) returns the transformation of c into its equivalent of the facet's character type (char_type, which is a member type alias of ctype's template parameter, charT).
The second version (2) fills the range beginning at to with the transformations of the
The transformation applied is the simplest reasonable transformation from
Internally, this function simply calls the virtual protected member do_widen, which does the above by default in both the generic template and the
Member type char_type is the facet's character type (defined as an alias of ctype's template parameter, charT).
The second version (2) always returns high.
Output:
In (2), the elements in the range
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
<locale>
- has_facet
- locale
- use_facet
-
wbuffer_convertC++11
-
wstring_convertC++11
functions
standard facets
ctype
- ctype::ctype
public member functions
ctype<char> specialization
protected members
public member function
<locale>
std::ctype::widen
char_type widen (char c) const;const char* widen (const char* low, const char* high, char_type* to) const;
Widen character(s)
The second version (2) fills the range beginning at to with the transformations of the
char
values in the range [low,high)
.The transformation applied is the simplest reasonable transformation from
char
values to their corresponding values of the destination type (char_type). Transformed characters cannot belong to categories (as returned by ctype::is) their original characters do not.Internally, this function simply calls the virtual protected member do_widen, which does the above by default in both the generic template and the
char
specialization (ctype<char>
).Parameters
- c
- Character (of type
char
) to widen.
Notice that the type of this parameter is the fundamental typechar
, no matter the character type the facet uses. - 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 (if any) are also converted, and the function proceeds beyond them, until the entire range is converted.
- to
- Pointer to a range of elements of the facet's character type (aliased as member type char_type) with enough storage to accommodate for as many elements as the range between low and high.
Member type char_type is the facet's character type (defined as an alias of ctype's template parameter, charT).
Return value
The first version (1) returns the transformation of c.Member type char_type is the facet's character type (defined as an alias of ctype's template parameter, charT).
The second version (2) always returns high.
Example
|
|
Output:
The first wide character is: S The wide-character phrase is: Seventy-seven foxes |
Data races
The object is accessed.In (2), the elements in the range
[low,high)
are accessed, and the elements in the array pointed by to are modified.Exception safety
If an exception is thrown, there are no changes in the facet object, although characters in the destination array may have been affected.See also
- ctype::narrow
- Narrow character(s) (public member function)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us