Skip to content
/ rc Public

Simple non-atomic reference counted word sized pointer types for C++11

Notifications You must be signed in to change notification settings

vimpunk/rc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

RC

This library provides a simple replacement for when std::shared_ptrs are not suitable. Rc stands for "reference counted" (very creative, I know), inspired by Rust's Arc. The API is similar to that of std::shared_ptr and std::weak_ptr.

Why

Rc has two main selling points.

One, both pointer types are non atomic (saving some of the associated overhead)--and thus not thread safe!

Second, both pointer types (rc andweak_rc) are the size of the architecture's word size (i.e. equal to sizeof(void*). Besides saving space, this allows rc pointers to be passed to C style functions that take a void* as their generic parameter. To faciliatate this, special conversion methods are provided to cast to void* and to reconstruct rc pointers from void*.

Disclaimer

USE AT YOUR OWN RISK! This library has not been thoroughly tested, it's a recent experiment that needs further evaluation.

About

Simple non-atomic reference counted word sized pointer types for C++11

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages