[ Web Proxy ]
URL:
Viewing: http://ja.cppreference.com/cpp/string/basic_string/copy [Back]  [Original]

std::basic_string<CharT,Traits,Allocator>::copy - cppreference.com
cppreference.com

std::basic_string<CharT,Traits,Allocator>::copy

: cppreference.com
 
C++
(C++20)
(C++20)
(C++17)
(C++11)
(C++11)
(C++11)
 
 
std::basic_string
 
<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

#include <string>
#include <iostream>

int main()
{
  std::string foo("quuuux");
  char bar[7]{};
  foo.copy(bar, sizeof bar);
  std::cout << bar << '\n';
}

:

quuuux


() [edit]

Web Proxy Viewer  |  New URL  |  Original Page