std::copyable_function:: copyable_function
|
copyable_function
(
)
noexcept
;
|
(1) | (C++26부터) |
|
copyable_function
(
std::
nullptr_t
)
noexcept
;
|
(2) | (C++26부터) |
|
copyable_function
(
const
copyable_function
&
other
)
;
|
(3) | (C++26부터) |
|
copyable_function
(
copyable_function
&&
other
)
noexcept
;
|
(4) | (C++26부터) |
|
template
<
class
F
>
copyable_function ( F && f ) ; |
(5) | (C++26부터) |
|
template
<
class
T,
class
...
CArgs
>
explicit copyable_function ( std:: in_place_type_t < T > , CArgs && ... args ) ; |
(6) | (C++26부터) |
|
template
<
class
T,
class
U,
class
...
CArgs
>
explicit
copyable_function
(
std::
in_place_type_t
<
T
>
,
|
(7) | (C++26부터) |
새로운
std::copyable_function
을 생성합니다.
std::copyable_function
을 생성합니다.
std::copyable_function
의 대상이
other
의 대상의 복사본인
std::copyable_function
을 생성합니다. 그렇지 않으면,
other
가 비어 있는 경우 빈
std::copyable_function
을 생성합니다.
std::copyable_function
의 대상이
other
인 대상을 가지는 객체를 생성합니다.
other
는 이동 생성 후 유효하지만 지정되지 않은 상태가 됩니다.
VT
를
std::
decay_t
<
F
>
라고 하자. 만약
f
가 null 함수 포인터, null 멤버 포인터 값, 또는 빈
std::copyable_function
(다른 특수화일 수 있음)인 경우, 빈
std::copyable_function
을 생성한다. 그렇지 않으면, 대상이
VT
타입이며
std::
forward
<
F
>
(
f
)
로 직접-비목록-초기화된
std::copyable_function
을 생성한다.
-
이 오버로드는
VT가copyable_function과 동일하지 않고 std::in_place_type_t 의 특수화도 아니며, /*is-callable-from*/ < VT > (아래 참조)가 true 인 경우에만 오버로드 해결에 참여한다. - 프로그램은 std:: is_constructible_v < VT, F > 또는 std:: is_copy_constructible_v < VT > 가 true 가 아닌 경우 형식이 잘못된다.
VT
를
std::
decay_t
<
T
>
로 정의합니다. 대상이
VT
타입이고
args...
를 사용하여
std::
forward
<
CArgs
>
(
args
)
...
로 직접-비목록-초기화된
std::copyable_function
을 생성합니다.
- 이 오버로드는 std:: is_constructible_v < VT, CArgs... > 와 /*is-callable-from*/ < VT > (아래 참조) 모두가 true 인 경우에만 오버로드 해결에 참여합니다.
-
VT가T와 동일한 타입이 아니거나 std:: is_copy_constructible_v < VT > 가 true 가 아닌 경우 프로그램의 형식이 올바르지 않습니다.
VT
를
std::
decay_t
<
T
>
로 정의합니다. 대상이
VT
타입이고
il, std::forward<CArgs>(args)...
로 직접-비목록-초기화된
std::copyable_function
을 생성합니다.
- 이 오버로드는 std:: is_constructible_v < VT, std:: initializer_list < U > & , CArgs... > 와 /*is-callable-from*/ < VT > (아래 참조) 모두 true 인 경우에만 오버로드 해결에 참여합니다.
-
VT가T와 동일한 타입이 아니거나 std:: is_copy_constructible_v < VT > 가 true 가 아닌 경우 프로그램의 형식이 올바르지 않습니다.
생성자
(5-7)
의 경우,
VT
가
Destructible
와
CopyConstructible
요구 사항을 모두 만족하지 않으면 동작이 정의되지 않습니다.
상수
/*is-callable-from*/
<
VT
>
는
std::copyable_function
의 템플릿 매개변수에 있는
cv
,
ref
, 그리고
noex
에 따라 아래와 같이 의존적입니다:
| cv ref noexcept ( noex ) | /*호출-가능-여부*/ < VT > |
| noexcept ( false ) |
std::
is_invocable_r_v
<
R, VT, Args...
>
&&
std:: is_invocable_r_v < R, VT & , Args... > |
| noexcept ( true ) |
std::
is_nothrow_invocable_r_v
<
R, VT, Args...
>
&&
std:: is_nothrow_invocable_r_v < R, VT & , Args... > |
| const noexcept ( false ) |
std::
is_invocable_r_v
<
R,
const
VT, Args...
>
&&
std:: is_invocable_r_v < R, const VT & , Args... > |
| const noexcept ( true ) |
std::
is_nothrow_invocable_r_v
<
R,
const
VT, Args...
>
&&
std:: is_nothrow_invocable_r_v < R, const VT & , Args... > |
| & noexcept ( false ) | std:: is_invocable_r_v < R, VT & , Args... > |
| & noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, VT & , Args... > |
| const & noexcept ( false ) | std:: is_invocable_r_v < R, const VT & , Args... > |
| const & noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, const VT & , Args... > |
| && noexcept ( false ) | std:: is_invocable_r_v < R, VT, Args... > |
| && noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, VT, Args... > |
| const && noexcept ( false ) | std:: is_invocable_r_v < R, const VT, Args... > |
| const && noexcept ( true ) | std:: is_nothrow_invocable_r_v < R, const VT, Args... > |
목차 |
매개변수
| other | - |
복사 또는 이동할 다른
std::copyable_function
|
| f | - | 래핑할 함수 또는 Callable 객체 |
| args | - | 대상 객체를 생성하기 위한 인자들 |
| il | - | std::initializer_list 대상 객체를 생성하기 위한 초기화자 목록 |
예외
VT
가 함수 포인터 타입이거나
std::reference_wrapper
의 특수화인 경우에는 예외가 발생하지 않습니다.
예제
|
이 섹션은 불완전합니다
이유: 예시가 없음 |
참고 항목
새로운
std::function
인스턴스를 생성합니다
(
std::function<R(Args...)>
의 public 멤버 함수)
|
|
새로운
std::move_only_function
객체를 생성합니다
(
std::move_only_function
의 public 멤버 함수)
|