std::basic_string<CharT,Traits,Allocator>::copy
: cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev ">
</tbody><tbody>
</tbody>
size_type copy( CharT* dest, size_type count, size_type pos = 0 ) const; |
(C++20) | |
constexpr size_type copy( CharT* dest, size_type count, size_type pos = 0 ) const; |
(C++20) | |
[pos, pos+count) dest count == npos [pos, size())
pos > size() std::out_of_range
| dest | - | |
| count | - | |
| pos | - |
pos > size() std::out_of_range
count
Run this code
#include <string>
#include <iostream>
int main()
{
std::string foo("quuuux");
char bar[7]{};
foo.copy(bar, sizeof bar);
std::cout << bar << '\n';
}
:
quuuux
| () |