Skip to content

Commit

Permalink
Update gc_pointer to avoid unnecessary registration
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Nov 5, 2023
1 parent 0b85bc9 commit 7fc6732
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.77_amd64.deb
sudo apt install build/meevax_0.5.78_amd64.deb
```

or
Expand Down Expand Up @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.77.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.78.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.77_amd64.deb`
| `package` | Generate debian package `meevax_0.5.78_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.77
0.5.78
11 changes: 9 additions & 2 deletions include/meevax/memory/gc_pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ inline namespace memory
template <typename T, REQUIRES(std::is_scalar<T>)>
explicit gc_pointer(T const& datum)
: pointer { datum }
, collector::registration { locate(pointer::get()) }
{}
{
assert(pointer::get() == nullptr);
}

auto operator =(gc_pointer const& gcp) -> auto &
{
Expand All @@ -62,6 +63,12 @@ inline namespace memory
return *this;
}

auto operator =(std::nullptr_t) -> auto &
{
reset();
return *this;
}

auto reset(gc_pointer const& gcp) -> void
{
pointer::reset(gcp);
Expand Down

0 comments on commit 7fc6732

Please sign in to comment.