From Jason Turner

[stoptoken.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpoia84fc2/{from.md → to.md} +18 -18
tmp/tmpoia84fc2/{from.md → to.md} RENAMED
@@ -1,33 +1,33 @@
1
  #### General <a id="stoptoken.general">[[stoptoken.general]]</a>
2
 
3
- The class `stop_token` provides an interface for querying whether a stop
4
- request has been made (`stop_requested`) or can ever be made
5
- (`stop_possible`) using an associated `stop_source` object
6
- [[stopsource]]. A `stop_token` can also be passed to a `stop_callback`
7
- [[stopcallback]] constructor to register a callback to be called when a
8
- stop request has been made from an associated `stop_source`.
9
 
10
  ``` cpp
11
  namespace std {
12
  class stop_token {
13
  public:
14
- // [stoptoken.cons], constructors, copy, and assignment
15
- stop_token() noexcept;
16
 
17
- stop_token(const stop_token&) noexcept;
18
- stop_token(stop_token&&) noexcept;
19
- stop_token& operator=(const stop_token&) noexcept;
20
- stop_token& operator=(stop_token&&) noexcept;
21
- ~stop_token();
22
  void swap(stop_token&) noexcept;
23
 
24
- // [stoptoken.mem], stop handling
25
- [[nodiscard]] bool stop_requested() const noexcept;
26
- [[nodiscard]] bool stop_possible() const noexcept;
27
 
28
- [[nodiscard]] friend bool operator==(const stop_token& lhs, const stop_token& rhs) noexcept;
29
- friend void swap(stop_token& lhs, stop_token& rhs) noexcept;
 
 
30
  };
31
  }
32
  ```
33
 
 
 
 
 
1
  #### General <a id="stoptoken.general">[[stoptoken.general]]</a>
2
 
3
+ The class `stop_token` models the concept `stoppable_token`. It shares
4
+ ownership of its stop state, if any, with its associated `stop_source`
5
+ object [[stopsource]] and any `stop_token` objects to which it compares
6
+ equal.
 
 
7
 
8
  ``` cpp
9
  namespace std {
10
  class stop_token {
11
  public:
12
+ template<class CallbackFn>
13
+ using callback_type = stop_callback<CallbackFn>;
14
 
15
+ stop_token() noexcept = default;
16
+
17
+ // [stoptoken.mem], member functions
 
 
18
  void swap(stop_token&) noexcept;
19
 
20
+ bool stop_requested() const noexcept;
21
+ bool stop_possible() const noexcept;
 
22
 
23
+ bool operator==(const stop_token& rhs) noexcept = default;
24
+
25
+ private:
26
+ shared_ptr<unspecified> stop-state; // exposition only
27
  };
28
  }
29
  ```
30
 
31
+ *`stop-state`* refers to the `stop_token`’s associated stop state. A
32
+ `stop_token` object is disengaged when *`stop-state`* is empty.
33
+