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 | ||||||||||||||||||||||||||||||||||||
Character array functions | ||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||
Miscellaneous | ||||||||||||||||||||||||||||||||||||
Defined in header <cstring> | ||
void* memmove(void* dest,constvoid* src,std::size_t count); | ||
Performs the following operations in order:
Ifdest orsrc is anull pointer orinvalid pointer, the behavior is undefined.
Contents |
dest | - | pointer to the memory location to copy to |
src | - | pointer to the memory location to copy from |
count | - | number of bytes to copy |
If there is asuitable created object, returns a pointer to it; otherwise returnsdest.
Despite the specification says a temporary buffer is used, actual implementations of this function do not incur the overhead of double copying or extra memory. For smallcount, it may load up and write out registers; for larger blocks, a common approach (glibc and bsd libc) is to copy bytes forwards from the beginning of the buffer if the destination starts before the source, and backwards from the end otherwise, with a fall back tostd::memcpy when there is no overlap at all.
Wherestrict aliasing prohibits examining the same memory as values of two different types,std::memmove
may be used to convert the values.
Output:
12345678901234456890
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 4064 | C++98 | it was unclear whether the returned pointer points to a suitable created object | made clear |
copies one buffer to another (function)[edit] | |
fills a buffer with a character (function)[edit] | |
copies a certain amount of wide characters between two, possibly overlapping, arrays (function)[edit] | |
(C++11) | copies a range of elements to a new location (function template)[edit] |
copies a range of elements in backwards order (function template)[edit] | |
(C++11) | checks if a type is trivially copyable (class template)[edit] |
C documentation formemmove |