From: Sergei Barannikov/AI Tools Lab /SRR/Engineer/Samsung Electronics Date: Tue, 12 Nov 2019 05:26:23 +0000 (+0300) Subject: Fix warnings generated for Index class (#8626) X-Git-Tag: submit/tizen/20191205.083104~308 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5455244dc0d307bc8054dcf70908f82071f28672;p=platform%2Fcore%2Fml%2Fnnfw.git Fix warnings generated for Index class (#8626) * Fix the type of the parameter of the copy constructor of the `Index` class. This silences -Wdeprecated-copy GCC 8.1+ warnings. * Make the copy constructor and copy assignment operator defaulted. This silences clang-tidy warnings suggesting to pass objects of `Index` class by const reference. * Fix description of inequality operators. Signed-off-by: Sergei Barannikov --- diff --git a/runtime/neurun/core/include/util/Index.h b/runtime/neurun/core/include/util/Index.h index d1fdc23..bd8eeb3 100644 --- a/runtime/neurun/core/include/util/Index.h +++ b/runtime/neurun/core/include/util/Index.h @@ -49,13 +49,13 @@ public: * * @param o Value in the underlying type */ - explicit Index(T o) : _index{o} {} + explicit Index(const T o) : _index{o} {} /** * @brief Copy Constructor * * @param o Object to be copied */ - Index(const Index &o) : _index{o._index} {} + Index(const Index &o) = default; /** * @brief Assign a value in the underlying time @@ -63,7 +63,7 @@ public: * @param o Value in the underlying type * @return Index& Reference of this pointer */ - Index &operator=(T o) + Index &operator=(const T o) { _index = o; return *this; @@ -75,11 +75,7 @@ public: * @param o Object to be copied * @return Index& Reference of this pointer */ - Index &operator=(const T &o) - { - _index = o._index; - return *this; - } + Index &operator=(const Index &o) = default; /** * @brief Equality operator @@ -99,14 +95,14 @@ public: * @brief Inquality operator * * @param o The other value in the underlying type to compare - * @return true if underlying value is the same, false otherwise + * @return true if underlying value is different, false otherwise */ bool operator!=(T o) const { return !(*this == o); } /** * @brief Inquality operator * * @param o The other object to compare - * @return true if underlying value is the same, false otherwise + * @return true if underlying value is different, false otherwise */ bool operator!=(const Index &o) const { return !(*this == o); }