Skip to content

Commit

Permalink
Added also push_front for convenience.
Browse files Browse the repository at this point in the history
  • Loading branch information
adya authored and powerof3 committed Jan 13, 2025
1 parent 12b140d commit 2958a95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions include/RE/B/BSTArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,9 @@ namespace RE
inline void insert(const_iterator position, const value_type& a_value) { emplace(position, a_value); }
inline void insert(const_iterator position, value_type&& a_value) { emplace(position, std::move(a_value)); }

inline void push_front(const value_type& a_value) { emplace(cbegin(), a_value); }
inline void push_front(value_type&& a_value) { emplace(cbegin(), std::move(a_value)); }

template <class... Args>
inline reference emplace(const_iterator position, Args&&... a_args)
{
Expand Down Expand Up @@ -693,11 +696,12 @@ namespace RE

/// Calculates the next value for the array capacity.
/// Capacity grows exponentially: hint * 2^level, where level is the number of times the capacity has grown.
[[nodiscard]] inline size_type next_capacity() const { return next_capacity(capacity()); }
[[nodiscard]]
inline size_type next_capacity() const { return next_capacity(capacity()); }

/// Calculates the next value for the array capacity.
/// Capacity grows exponentially: hint * 2^level, where level is the number of times the capacity has grown.
[[nodiscard]] inline size_type next_capacity(size_type a_hint) const
inline size_type next_capacity(size_type a_hint) const
{
auto cap = a_hint;
cap = cap > 0 ? static_cast<size_type>(std::ceil(static_cast<float>(cap) * GROWTH_FACTOR)) : DF_CAP;
Expand Down
4 changes: 2 additions & 2 deletions include/RE/B/BSTEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ namespace RE

if (notifying) {
if (std::find(pendingRegisters.begin(), pendingRegisters.end(), a_eventSink) == pendingRegisters.end()) {
pendingRegisters.insert(pendingRegisters.begin(), a_eventSink);
pendingRegisters.push_front(a_eventSink);
}
} else {
if (std::find(sinks.begin(), sinks.end(), a_eventSink) == sinks.end()) {
sinks.insert(sinks.begin(), a_eventSink);
sinks.push_front(a_eventSink);
}
}

Expand Down

0 comments on commit 2958a95

Please sign in to comment.