Closed Manuzor closed 8 years ago
Things done from the TODO list:
kr::Owned
and kr::Borrow
now work with const
.kr::RefCounted
before now uses kr::Owned
or kr::Borrow
.This means it would be ready to be merged back. Any volunteers for reviewing?
I know there are a lot of changes. If one of you is willing, we could go over the crucial parts together. Not every little change has to be reviewed, of course.
If none of you would like to review this, then I will just merge it back.
Regular reference counting has some problems:
Inspired by Rust, I have come up with an ownership system that does reference counting only on special borrowed objects, that wrap the original object. I guess you could say it is a combination of
std::unique_ptr
andstd::shared_ptr
.An example should make things more clear:
Advantages:
int bar = 42; auto oBar = own(&bar, [](int*){});
On top of this, something like a
make
function would be possible, which takes care of specifying the deleter for you:TODO
Things that are still left to do at this point:
const
.