Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static for some _Xxxx() member functions #3755

Merged
merged 5 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -3551,11 +3551,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