From df7248039553b3ebd338380c3ef0428b0e046e79 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 14 Aug 2020 09:38:45 -0400 Subject: common: Make use of [[nodiscard]] where applicable Now that clang-format makes [[nodiscard]] attributes format sensibly, we can apply them to several functions within the common library to allow the compiler to complain about any misuses of the functions. --- src/common/param_package.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/common/param_package.h') diff --git a/src/common/param_package.h b/src/common/param_package.h index 6a0a9b656..c8a70bfa9 100644 --- a/src/common/param_package.h +++ b/src/common/param_package.h @@ -24,14 +24,14 @@ public: ParamPackage& operator=(const ParamPackage& other) = default; ParamPackage& operator=(ParamPackage&& other) = default; - std::string Serialize() const; - std::string Get(const std::string& key, const std::string& default_value) const; - int Get(const std::string& key, int default_value) const; - float Get(const std::string& key, float default_value) const; + [[nodiscard]] std::string Serialize() const; + [[nodiscard]] std::string Get(const std::string& key, const std::string& default_value) const; + [[nodiscard]] int Get(const std::string& key, int default_value) const; + [[nodiscard]] float Get(const std::string& key, float default_value) const; void Set(const std::string& key, std::string value); void Set(const std::string& key, int value); void Set(const std::string& key, float value); - bool Has(const std::string& key) const; + [[nodiscard]] bool Has(const std::string& key) const; void Erase(const std::string& key); void Clear(); -- cgit v1.2.3