diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-11-20 17:51:49 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-11-20 17:51:49 +0100 |
commit | 304e4dfabe4555dff4aa72e75b677405fd30d1b3 (patch) | |
tree | ac934000415b46f784bda25ba671e74b9481573b /src/unique.hpp | |
parent | 872826ecaca5370e3492385cff3795d995b33ec7 (diff) | |
download | lanes-304e4dfabe4555dff4aa72e75b677405fd30d1b3.tar.gz lanes-304e4dfabe4555dff4aa72e75b677405fd30d1b3.tar.bz2 lanes-304e4dfabe4555dff4aa72e75b677405fd30d1b3.zip |
Some [[nodiscard]] boyscouting
Diffstat (limited to 'src/unique.hpp')
-rw-r--r-- | src/unique.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/unique.hpp b/src/unique.hpp index c214dbc..aec5610 100644 --- a/src/unique.hpp +++ b/src/unique.hpp | |||
@@ -3,8 +3,9 @@ | |||
3 | // ################################################################################################# | 3 | // ################################################################################################# |
4 | 4 | ||
5 | // A unique type generator | 5 | // A unique type generator |
6 | // Marking *all* Unique<> types as [[nodiscard]] is maybe overkill, but there is no way of marking a specific instanciation | ||
6 | template <typename T, typename TAG, typename specialization = void> | 7 | template <typename T, typename TAG, typename specialization = void> |
7 | class Unique | 8 | class [[nodiscard]] Unique |
8 | { | 9 | { |
9 | private: | 10 | private: |
10 | T val; // no default initialization so that std::is_trivial_v<Unique<T>> == true | 11 | T val; // no default initialization so that std::is_trivial_v<Unique<T>> == true |
@@ -69,7 +70,8 @@ class Unique | |||
69 | }; | 70 | }; |
70 | 71 | ||
71 | template <typename T, typename TAG> | 72 | template <typename T, typename TAG> |
72 | class Unique<T, TAG, std::enable_if_t<!std::is_scalar_v<T>>> | 73 | // Marking *all* Unique<> types as [[nodiscard]] is maybe overkill, but there is no way of marking a specific instanciation |
74 | class [[nodiscard]] Unique<T, TAG, std::enable_if_t<!std::is_scalar_v<T>>> | ||
73 | : public T | 75 | : public T |
74 | { | 76 | { |
75 | public: | 77 | public: |