Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:

reporting:
name: "Pull Request Report"
if: ${{ github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
needs: compilation
steps:
Expand Down
11 changes: 10 additions & 1 deletion inkcpp/simple_restorable_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@ namespace ink::runtime::internal
void restore();
void forget();

protected:
virtual void overflow(T*& buffer, size_t& size) {
throw ink_exception("Stack overflow!");
}

void initialize_data(T* buffer, size_t size) {
inkAssert(_buffer == nullptr && _size == 0, "Try to double initialize a restorable stack."
"To extend the size use overflow()");
_buffer = buffer;
_size = size;
}
private:
T* _buffer;
size_t _size;
Expand All @@ -50,7 +58,8 @@ namespace ink::runtime::internal
managed_restorable_stack(const T& null) : simple_restorable_stack<T>(nullptr, 0, null) { }
template<bool ... D, bool con = dynamic, enable_if_t<!con, bool> = true>
managed_restorable_stack(const T& null) :
_stack{}, simple_restorable_stack<T>(_stack.data(), N, null) {}
simple_restorable_stack<T>(nullptr, 0, null), _stack{}
{ base::initialize_data(_stack.data(), N); }
virtual void overflow(T*& buffer, size_t& size) override final {
if constexpr (dynamic) {
if (buffer) {
Expand Down
Loading