Ruby 4.1.0dev (2026-10-21 revision 536dc6f98b72e6999a84bb6373562c43cb1ddf8a)
arena.hpp
Go to the documentation of this file.
1
6#ifndef PRISM_ARENA_HPP
7#define PRISM_ARENA_HPP
8
10
11#include "prism/arena.h"
12
13#include <memory>
14
15namespace prism {
16
24 void operator()(pm_arena_t *arena) const noexcept { pm_arena_free(arena); }
25};
26
28using unique_arena = std::unique_ptr<pm_arena_t, arena_deleter>;
29
35[[nodiscard]] inline unique_arena
36make_arena() noexcept {
37 return unique_arena(pm_arena_new());
38}
39
40}
41
42#endif
A bump allocator for the prism parser.
std::unique_ptr< pm_arena_t, arena_deleter > unique_arena
An owned arena.
Definition arena.hpp:28
unique_arena make_arena() noexcept
Allocate a new arena.
Definition arena.hpp:36
Frees an arena with pm_arena_free.
Definition arena.hpp:18
void operator()(pm_arena_t *arena) const noexcept
Frees the given arena.
Definition arena.hpp:24