33
Concurrency support library
[thread]
33.3
Stop tokens
[thread.stoptoken]
33.3.5
Class template
stop_
callback
[stopcallback]
33.3.5.1
General
[stopcallback.general]
1
#
🔗
namespace
std
{
template
<
class
Callback
>
class
stop_callback
{
public
:
using
callback_type
=
Callback;
//
[stopcallback.
cons]
, constructors and destructor
template
<
class
C
>
explicit
stop_callback
(
const
stop_token
&
st, C
&
&
cb
)
noexcept
(
is_nothrow_constructible_v
<
Callback, C
>
)
;
template
<
class
C
>
explicit
stop_callback
(
stop_token
&
&
st, C
&
&
cb
)
noexcept
(
is_nothrow_constructible_v
<
Callback, C
>
)
;
~
stop_callback
(
)
; stop_callback
(
const
stop_callback
&
)
=
delete
; stop_callback
(
stop_callback
&
&
)
=
delete
; stop_callback
&
operator
=
(
const
stop_callback
&
)
=
delete
; stop_callback
&
operator
=
(
stop_callback
&
&
)
=
delete
;
private
:
Callback callback;
//
exposition only
}
;
template
<
class
Callback
>
stop_callback
(
stop_token, Callback
)
-
>
stop_callback
<
Callback
>
;
}
2
#
Mandates
:
stop_
callback
is instantiated with an argument for the template parameter
Callback
that satisfies both
invocable
and
destructible
.
3
#
Preconditions
:
stop_
callback
is instantiated with an argument for the template parameter
Callback
that models both
invocable
and
destructible
.