在线文档教程
C++
字符串 | Strings

std::wmemmove

STD:Wmemmove

Defined in header
wchar_t* wmemmove( wchar_t* dest, const wchar_t* src, std::size_t count

精确复制count所指向的宽字符数组中的连续宽字符。src指向的宽字符数组dest...

如果count等于零,函数什么也不做。

数组可能会重叠:复制就像宽字符被复制到临时宽字符数组中一样,然后从临时数组复制到dest...

参数

dest-pointer to the wide character array to copy to
src-pointer to the wide character array to copy from
count-number of wide characters to copy

返回值

返回dest...

注记

此函数不区分区域设置,也不注意wchar_t它复制的对象:NULL以及无效字符也被复制。

二次

#include <iostream> #include <cwchar> #include <locale> #include <clocale> 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'; }

二次

可能的产出:

二次

αβγδεζηθικλμνξοπρστυφχψω αβγδδεζθικλμνξοπρστυφχψω

二次

另见

wmemcpycopies a certain amount of wide characters between two non-overlapping arrays (function)
memmovemoves one buffer to another (function)
copycopy_if (C++11)copies a range of elements to a new location (function template)
copy_backwardcopies a range of elements in backwards order (function template)

C.wmemmove的文档

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/string/Wide/wmemmove