std::wmemmove(3)
okay bestie 💖 welcome to std::wmemmove(3) from the C++ Standard Libary — she's the overlapping-memory wide-character copy queen, and yes, this page is gonna be a whole vibe. 🦋
🌸 NAME 🌸
std::wmemmove - std::wmemmove — literally the name, no plot twist, periodt. 💅
✨ Synopsis ✨
Defined in header <cwchar> — here's the exact signature, bestie:
wchar_t* wmemmove( wchar_t* dest, const wchar_t* src, std::size_t count );
Copies exactly count successive wide characters from the wide character array pointed to by src to the wide character array pointed to by dest.
If count is zero, the function does nothing. Like, zero, nothing, she's not doing extra credit. 😌
The arrays may overlap: copying takes place as if the wide characters were copied to a temporary wide character array and then copied from the temporary array to dest. Overlap? She said "I got you." 🫶
🎀 Parameters 🎀
dest— pointer to the wide character array to copy tosrc— pointer to the wide character array to copy fromcount— number of wide characters to copy
💫 Return value 💫
Returns a copy of dest. That's it, that's the return value. ✨
🧚 Notes 🧚
This function is not locale-sensitive and pays no attention to the values of the wchar_t objects it copies: nulls as well as invalid characters are copied too. So she copies the nulls and the invalid characters, no judgment, no filtering. 💀
🌈 Example 🌈
// Run this code
#include <clocale>
#include <cwchar>
#include <iostream>
#include <locale>
int main()
{
std::setlocale(LC_ALL, "en_US.utf8");
std::wcout.imbue(std::locale("en_US.utf8"));
wchar_t str[] = L"αβγδεζηθικλμνξοπρστυφχψω";
std::wcout << str << '\n';
std::wmemmove(str + 4, str + 3, 3); // copy from [δεζ] to [εζη]
std::wcout << str << '\n';
}
Possible output:
αβγδεζηθικλμνξοπρστυφχψω
αβγδδεζθικλμνξοπρστυφχψω
👑 See also 👑
wmemcpy— copies a certain amount of wide characters between two non-overlapping arrays (function)memmove— moves one buffer to another (function)copy— copies a range of elements to a new locationcopy_if— (function template) (C++11)copy_backward— copies a range of elements in backwards order (function template)- C documentation for
wmemmove
xoxo bestie 💅 source: http://cppreference.com — date/version: 2024.06.10 — page: std::wmemmove(3). slay. 🫶
📦 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