Skip to content

Commit

Permalink
Add static for some _Xxxx() member functions (#3755)
Browse files Browse the repository at this point in the history
  • Loading branch information
achabense authored Jun 15, 2023
1 parent f68e64c commit 444ea04
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions stl/inc/array
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,12 @@ public:
return _Elems;
}

[[noreturn]] void _Xran() const {
_Ty _Elems[_Size];

private:
[[noreturn]] static void _Xran() {
_Xout_of_range("invalid array<T, N> subscript");
}

_Ty _Elems[_Size];
};

#if _HAS_CXX17
Expand Down Expand Up @@ -758,13 +759,14 @@ public:
return nullptr;
}

[[noreturn]] void _Xran() const {
_Xout_of_range("invalid array<T, 0> subscript");
}

conditional_t<disjunction_v<is_default_constructible<_Ty>, _Is_implicitly_default_constructible<_Ty>>, _Ty,
_Empty_array_element>
_Elems[1];

private:
[[noreturn]] static void _Xran() {
_Xout_of_range("invalid array<T, 0> subscript");
}
};

_EXPORT_STD template <class _Ty, size_t _Size, enable_if_t<_Size == 0 || _Is_swappable<_Ty>::value, int> = 0>
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/bitset
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,15 @@ private:
return *this;
}

[[noreturn]] void _Xinv() const {
[[noreturn]] static void _Xinv() {
_Xinvalid_argument("invalid bitset char");
}

[[noreturn]] void _Xoflo() const {
[[noreturn]] static void _Xoflo() {
_Xoverflow_error("bitset overflow");
}

[[noreturn]] void _Xran() const {
[[noreturn]] static void _Xran() {
_Xout_of_range("invalid bitset position");
}

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -1536,11 +1536,11 @@ private:
}
}

[[noreturn]] void _Xlen() const {
[[noreturn]] static void _Xlen() {
_Xlength_error("deque<T> too long");
}

[[noreturn]] void _Xran() const {
[[noreturn]] static void _Xran() {
_Xout_of_range("invalid deque<T> subscript");
}

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/vector
Original file line number Diff line number Diff line change
Expand Up @@ -3552,11 +3552,11 @@ public:
}
}

[[noreturn]] void _Xlen() const {
[[noreturn]] static void _Xlen() {
_Xlength_error("vector<bool> too long");
}

[[noreturn]] void _Xran() const {
[[noreturn]] static void _Xran() {
_Xout_of_range("invalid vector<bool> subscript");
}
};
Expand Down

0 comments on commit 444ea04

Please sign in to comment.