src: add some noexcept
This commit is contained in:
@@ -69,7 +69,7 @@ private:
|
||||
xspan_check_range(ptr, base, size_in_bytes);
|
||||
}
|
||||
#else
|
||||
forceinline_constexpr void assertInvariants() const noexcept {}
|
||||
forceinline void assertInvariants() const noexcept {}
|
||||
#endif
|
||||
|
||||
static inline pointer makeNotNull(pointer p) {
|
||||
@@ -288,49 +288,49 @@ public:
|
||||
reinterpret_cast<rpointer>(base));
|
||||
}
|
||||
|
||||
bool operator==(pointer other) const { return ptr == other; }
|
||||
bool operator==(pointer other) const noexcept { return ptr == other; }
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator==(U *other) const {
|
||||
operator==(U *other) const noexcept {
|
||||
return ptr == other;
|
||||
}
|
||||
bool operator!=(pointer other) const { return ptr != other; }
|
||||
bool operator!=(pointer other) const noexcept { return ptr != other; }
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator!=(U *other) const {
|
||||
operator!=(U *other) const noexcept {
|
||||
return ptr != other;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator==(const PtrOrSpan<U> &other) const {
|
||||
operator==(const PtrOrSpan<U> &other) const noexcept {
|
||||
return ptr == other.ptr;
|
||||
}
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator==(const PtrOrSpanOrNull<U> &other) const {
|
||||
operator==(const PtrOrSpanOrNull<U> &other) const noexcept {
|
||||
return ptr == other.ptr;
|
||||
}
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator==(const Span<U> &other) const {
|
||||
operator==(const Span<U> &other) const noexcept {
|
||||
return ptr == other.ptr;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator!=(const PtrOrSpan<U> &other) const {
|
||||
return !(*this == other);
|
||||
operator!=(const PtrOrSpan<U> &other) const noexcept {
|
||||
return ptr != other.ptr;
|
||||
}
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator!=(const PtrOrSpanOrNull<U> &other) const {
|
||||
return !(*this == other);
|
||||
operator!=(const PtrOrSpanOrNull<U> &other) const noexcept {
|
||||
return ptr != other.ptr;
|
||||
}
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator!=(const Span<U> &other) const {
|
||||
return !(*this == other);
|
||||
operator!=(const Span<U> &other) const noexcept {
|
||||
return ptr != other.ptr;
|
||||
}
|
||||
|
||||
// check for notNull here
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
// inverse logic for ensuring valid pointers from existing objects
|
||||
inline pointer ensurePtr() const { return ptr; }
|
||||
// debug
|
||||
forceinline_constexpr void assertInvariants() const noexcept {}
|
||||
forceinline void assertInvariants() const noexcept {}
|
||||
|
||||
public:
|
||||
#if XSPAN_CONFIG_ENABLE_IMPLICIT_CONVERSION || 1
|
||||
@@ -132,15 +132,15 @@ public:
|
||||
|
||||
// comparison
|
||||
|
||||
bool operator==(pointer other) const { return ptr == other; }
|
||||
bool operator==(pointer other) const noexcept { return ptr == other; }
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator==(U *other) const {
|
||||
operator==(U *other) const noexcept {
|
||||
return ptr == other;
|
||||
}
|
||||
template <class U>
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(bool)
|
||||
operator==(const Ptr<U> &other) const {
|
||||
operator==(const Ptr<U> &other) const noexcept {
|
||||
return ptr == other.ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,10 @@ public:
|
||||
|
||||
// nullptr
|
||||
forceinline CSelf(std::nullptr_t) noexcept : ptr(nullptr), base(nullptr), size_in_bytes(0) {}
|
||||
forceinline Self &operator=(std::nullptr_t) noexcept {
|
||||
ptr = nullptr;
|
||||
return *this;
|
||||
}
|
||||
#undef CSelf
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user