From Jason Turner

[stopcallback.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphr4tbqnj/{from.md → to.md} +19 -15
tmp/tmphr4tbqnj/{from.md → to.md} RENAMED
@@ -1,40 +1,44 @@
1
  #### General <a id="stopcallback.general">[[stopcallback.general]]</a>
2
 
3
  ``` cpp
4
  namespace std {
5
- template<class Callback>
6
  class stop_callback {
7
  public:
8
- using callback_type = Callback;
9
 
10
  // [stopcallback.cons], constructors and destructor
11
- template<class C>
12
- explicit stop_callback(const stop_token& st, C&& cb)
13
- noexcept(is_nothrow_constructible_v<Callback, C>);
14
- template<class C>
15
- explicit stop_callback(stop_token&& st, C&& cb)
16
- noexcept(is_nothrow_constructible_v<Callback, C>);
17
  ~stop_callback();
18
 
19
  stop_callback(const stop_callback&) = delete;
20
  stop_callback(stop_callback&&) = delete;
21
  stop_callback& operator=(const stop_callback&) = delete;
22
  stop_callback& operator=(stop_callback&&) = delete;
23
 
24
  private:
25
- Callback callback; // exposition only
26
  };
27
 
28
- template<class Callback>
29
- stop_callback(stop_token, Callback) -> stop_callback<Callback>;
30
  }
31
  ```
32
 
33
  *Mandates:* `stop_callback` is instantiated with an argument for the
34
- template parameter `Callback` that satisfies both `invocable` and
35
  `destructible`.
36
 
37
- *Preconditions:* `stop_callback` is instantiated with an argument for
38
- the template parameter `Callback` that models both `invocable` and
39
- `destructible`.
 
 
 
 
40
 
 
1
  #### General <a id="stopcallback.general">[[stopcallback.general]]</a>
2
 
3
  ``` cpp
4
  namespace std {
5
+ template<class CallbackFn>
6
  class stop_callback {
7
  public:
8
+ using callback_type = CallbackFn;
9
 
10
  // [stopcallback.cons], constructors and destructor
11
+ template<class Initializer>
12
+ explicit stop_callback(const stop_token& st, Initializer&& init)
13
+ noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
14
+ template<class Initializer>
15
+ explicit stop_callback(stop_token&& st, Initializer&& init)
16
+ noexcept(is_nothrow_constructible_v<CallbackFn, Initializer>);
17
  ~stop_callback();
18
 
19
  stop_callback(const stop_callback&) = delete;
20
  stop_callback(stop_callback&&) = delete;
21
  stop_callback& operator=(const stop_callback&) = delete;
22
  stop_callback& operator=(stop_callback&&) = delete;
23
 
24
  private:
25
+ CallbackFn callback-fn; // exposition only
26
  };
27
 
28
+ template<class CallbackFn>
29
+ stop_callback(stop_token, CallbackFn) -> stop_callback<CallbackFn>;
30
  }
31
  ```
32
 
33
  *Mandates:* `stop_callback` is instantiated with an argument for the
34
+ template parameter `CallbackFn` that satisfies both `invocable` and
35
  `destructible`.
36
 
37
+ *Remarks:* For a type `Initializer`, if
38
+ `stoppable-callback-for<CallbackFn, stop_token, Initializer>` is
39
+ satisfied, then
40
+ `stoppable-callback-for<CallbackFn, stop_token, Initializer>` is
41
+ modeled. The exposition-only *`callback-fn`* member is the associated
42
+ callback function [[stoptoken.concepts]] of `stop_callback< CallbackFn>`
43
+ objects.
44