std::ranges::common_view<V>:: base
From cppreference.net
<
cpp
|
ranges
|
common view
C++
Ranges library
|
||||||||||||||||||||||
| Range primitives | |||||||
|
|||||||
| Range concepts | |||||||||||||||||||
|
|||||||||||||||||||
| Range factories | |||||||||
|
|||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||
| Helper items | |||||||||||||||||
|
|
||||||||||||||||
|
constexpr
V base
(
)
const
&
requires
std::
copy_constructible
<
V
>
;
|
(1) | (C++20 이후) |
|
constexpr
V base
(
)
&&
;
|
(2) | (C++20 이후) |
기본 뷰의 복사본을 반환합니다.
1)
기본 뷰에서 결과를 복사 생성합니다.
2)
결과를 기본 뷰에서 이동 생성합니다.
매개변수
(없음)
반환값
기본 뷰의 복사본.
예제
이 코드 실행
#include <iostream> #include <ranges> #include <string> int main() { std::string str { "C++20" }; auto view = std::views::common(str); std::string copy_of_str = view.base(); std::cout << "copy of str: [" << copy_of_str << "]\n"; std::cout << "view.base(): [" << view.base() << "]\n"; std::string move_str = std::move(view.base()); std::cout << "moved str: [" << move_str << "]\n"; std::cout << "view.base(): [" << view.base() << "]\n"; // unspecified }
가능한 출력:
copy of str: [C++20] view.base(): [C++20] moved str: [C++20] view.base(): []