-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Replace .at() calls with custom method showing actual source location on failure #12684
Conversation
rpcs3/util/types.hpp
Outdated
@@ -1056,6 +1056,41 @@ template <typename T, usz Size> | |||
return static_cast<u32>(Size); | |||
} | |||
|
|||
template <typename T, usz Size, typename U> | |||
[[nodiscard]] constexpr auto& at32(const T (&array)[Size], u32 index, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use std::size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this overload is better removed in this widely used header, and std::size can help with that. A global concept can be written as std::as_const(x)[0]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll look into it
5840eb4
to
a66cdb9
Compare
{ | ||
broadcast_insert(range); | ||
m_data[block_for(range.start)].insert_or_assign(range.start, std::forward<T>(value)); | ||
} | ||
|
||
inline iterator find(const u32 key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the methods find
and at
have been swapped unintendedly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed at
and added count
to make it compatible with at32 requirements
I'd rather have these data types wrapped or something instead of replacing all the calls with some obscure syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSX side lgtm
Works like .at() but uses source location for "exception".
I think an alternative (replacing container types) would be too intrusive and not always possible. |
Adds a supplement for common STL .at() methods but which also provides source location.