diff options
| author | 2020-08-16 01:47:54 -0400 | |
|---|---|---|
| committer | 2020-08-16 01:47:54 -0400 | |
| commit | db96034ea429cf0b0b5e2bac790392d9e2f50990 (patch) | |
| tree | 9a1ed0bfc2d01d67d0f62383dbb2a1f4c9fb4eca /src/common/thread_queue_list.h | |
| parent | Merge pull request #4519 from lioncash/semi (diff) | |
| parent | common/compression: Roll back std::span changes (diff) | |
| download | yuzu-db96034ea429cf0b0b5e2bac790392d9e2f50990.tar.gz yuzu-db96034ea429cf0b0b5e2bac790392d9e2f50990.tar.xz yuzu-db96034ea429cf0b0b5e2bac790392d9e2f50990.zip | |
Merge pull request #4528 from lioncash/discard
common: Make use of [[nodiscard]] where applicable
Diffstat (limited to 'src/common/thread_queue_list.h')
| -rw-r--r-- | src/common/thread_queue_list.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 791f99a8c..def9e5d8d 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h | |||
| @@ -18,14 +18,14 @@ struct ThreadQueueList { | |||
| 18 | using Priority = unsigned int; | 18 | using Priority = unsigned int; |
| 19 | 19 | ||
| 20 | // Number of priority levels. (Valid levels are [0..NUM_QUEUES).) | 20 | // Number of priority levels. (Valid levels are [0..NUM_QUEUES).) |
| 21 | static const Priority NUM_QUEUES = N; | 21 | static constexpr Priority NUM_QUEUES = N; |
| 22 | 22 | ||
| 23 | ThreadQueueList() { | 23 | ThreadQueueList() { |
| 24 | first = nullptr; | 24 | first = nullptr; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | // Only for debugging, returns priority level. | 27 | // Only for debugging, returns priority level. |
| 28 | Priority contains(const T& uid) const { | 28 | [[nodiscard]] Priority contains(const T& uid) const { |
| 29 | for (Priority i = 0; i < NUM_QUEUES; ++i) { | 29 | for (Priority i = 0; i < NUM_QUEUES; ++i) { |
| 30 | const Queue& cur = queues[i]; | 30 | const Queue& cur = queues[i]; |
| 31 | if (std::find(cur.data.cbegin(), cur.data.cend(), uid) != cur.data.cend()) { | 31 | if (std::find(cur.data.cbegin(), cur.data.cend(), uid) != cur.data.cend()) { |
| @@ -36,7 +36,7 @@ struct ThreadQueueList { | |||
| 36 | return -1; | 36 | return -1; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | T get_first() const { | 39 | [[nodiscard]] T get_first() const { |
| 40 | const Queue* cur = first; | 40 | const Queue* cur = first; |
| 41 | while (cur != nullptr) { | 41 | while (cur != nullptr) { |
| 42 | if (!cur->data.empty()) { | 42 | if (!cur->data.empty()) { |
| @@ -49,7 +49,7 @@ struct ThreadQueueList { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | template <typename UnaryPredicate> | 51 | template <typename UnaryPredicate> |
| 52 | T get_first_filter(UnaryPredicate filter) const { | 52 | [[nodiscard]] T get_first_filter(UnaryPredicate filter) const { |
| 53 | const Queue* cur = first; | 53 | const Queue* cur = first; |
| 54 | while (cur != nullptr) { | 54 | while (cur != nullptr) { |
| 55 | if (!cur->data.empty()) { | 55 | if (!cur->data.empty()) { |
| @@ -129,7 +129,7 @@ struct ThreadQueueList { | |||
| 129 | first = nullptr; | 129 | first = nullptr; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | bool empty(Priority priority) const { | 132 | [[nodiscard]] bool empty(Priority priority) const { |
| 133 | const Queue* cur = &queues[priority]; | 133 | const Queue* cur = &queues[priority]; |
| 134 | return cur->data.empty(); | 134 | return cur->data.empty(); |
| 135 | } | 135 | } |