diff --git a/sycl/include/sycl/nd_range.hpp b/sycl/include/sycl/nd_range.hpp index 8d1fd28c2bedc..1efb3879ca4c7 100644 --- a/sycl/include/sycl/nd_range.hpp +++ b/sycl/include/sycl/nd_range.hpp @@ -39,21 +39,23 @@ template class nd_range { public: __SYCL2020_DEPRECATED("offsets are deprecated in SYCL2020") nd_range(range globalSize, range localSize, - id offset) + id offset) noexcept : globalSize(globalSize), localSize(localSize), offset(offset) {} - nd_range(range globalSize, range localSize) + nd_range(range globalSize, range localSize) noexcept : globalSize(globalSize), localSize(localSize), offset(id()) { } - range get_global_range() const { return globalSize; } + range get_global_range() const noexcept { return globalSize; } - range get_local_range() const { return localSize; } + range get_local_range() const noexcept { return localSize; } - range get_group_range() const { return globalSize / localSize; } + range get_group_range() const noexcept { + return globalSize / localSize; + } __SYCL2020_DEPRECATED("offsets are deprecated in SYCL2020") - id get_offset() const { return offset; } + id get_offset() const noexcept { return offset; } // Common special member functions for by-value semantics nd_range(const nd_range &rhs) = default; @@ -61,15 +63,18 @@ template class nd_range { nd_range &operator=(const nd_range &rhs) = default; nd_range &operator=(nd_range &&rhs) = default; nd_range() = default; + ~nd_range() = default; - // Common member functions for by-value semantics - bool operator==(const nd_range &rhs) const { - return (rhs.globalSize == this->globalSize) && - (rhs.localSize == this->localSize) && (rhs.offset == this->offset); + // Common hidden friend functions for by-value semantics + friend bool operator==(const nd_range &lhs, + const nd_range &rhs) { + return (lhs.globalSize == rhs.globalSize) && + (lhs.localSize == rhs.localSize) && (lhs.offset == rhs.offset); } - bool operator!=(const nd_range &rhs) const { - return !(*this == rhs); + friend bool operator!=(const nd_range &lhs, + const nd_range &rhs) { + return !(lhs == rhs); } friend class sycl::_V1::detail::nd_range_view;