| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
Defined in header <cwchar> | ||
wchar_t* wmemset(wchar_t* dest,wchar_t ch,std::size_t count); | ||
Copies the wide characterch into each of the firstcount wide characters of the wide character array pointed to bydest.
If overflow occurs, the behavior is undefined.
Ifcount is zero, the function does nothing.
Contents |
| dest | - | pointer to the wide character array to fill |
| ch | - | fill wide character |
| count | - | number of wide characters to fill |
Returns a copy ofdest.
This function is not locale-sensitive and pays no attention to the values of thewchar_t objects it writes: nulls as well as invalid wide characters are written too.
#include <clocale>#include <cwchar>#include <iostream>#include <locale> int main(){wchar_t ar[4]={L'1', L'2', L'3', L'4'}; std::wmemset(ar, L'\U0001f34c',2);// replaces [12] with the 🍌 bananas std::wmemset(ar+2, L'蕉',2);// replaces [34] with the 蕉 bananas std::setlocale(LC_ALL,"en_US.utf8");std::wcout.imbue(std::locale("en_US.utf8"));std::wcout<<std::wstring(ar,4)<<'\n';}
Possible output:
🍌🍌蕉蕉
| fills a buffer with a character (function)[edit] | |
| copies a certain amount of wide characters between two non-overlapping arrays (function)[edit] | |
| copy-assigns the given value to N elements in a range (function template)[edit] | |
C documentation forwmemset | |