std::wmemset(3)
π«Ά NAME π«Ά
okay so bestie, this is the std::wmemset(3) page from the C++ Standard Library β¨ β std::wmemset β std::wmemset. yes, the name section is literally the name twice. iconic.
πΈ SYNOPSIS πΈ
Defined in header <cwchar>:
wchar_t* wmemset( wchar_t* dest, wchar_t ch, std::size_t count );
Copies the wide character ch into each of the first count wide characters of the wide character array pointed to by dest.
β οΈ If overflow occurs, the behavior is undefined. no cap, that's the scary part. π
If count is zero, the function does nothing. literally nothing, bestie. π
π PARAMETERS π
destβ pointer to the wide character array to fillchβ fill wide charactercountβ number of wide characters to fill
π RETURN VALUE π
Returns a copy of dest. that's it, that's the return. π«Ά
π¦ NOTES π¦
This function is not locale-sensitive and pays no attention to the values of the wchar_t objects it writes: nulls as well as invalid wide characters are written too. no thoughts, just writes. π
π EXAMPLE π
// Run this code
#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:
ππθθ
π SEE ALSO π
memsetβ fills a buffer with a character (function)wmemcpyβ copies a certain amount of wide characters between two non-overlapping arrays (function)fill_nβ copy-assigns the given value to N elements in a range (function template)- C documentation for
wmemset
and that's the whole page, bestie π«Άπ
β source: http://cppreference.com, version/date: 2024.06.10, manual page: std::wmemset(3).
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms