Commit Graph

17 Commits

Author SHA1 Message Date
Avi Kivity
7f8d88371a Add LICENSE, NOTICE, and copyright headers to all source files.
The two files imported from the OSv project retain their original licenses.
2015-02-19 16:52:34 +02:00
Pekka Enberg
fc7cb5ab5e shared_ptr: Fix assignment of polymorphic types
Fix the assignment operator to work with polymorphic types.

Suggested by Nadav.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-02-08 10:24:21 +02:00
Tomasz Grabiec
24227fd933 shared_ptr: Add helpers for hashing shared_ptr<> by value 2015-01-25 13:12:04 +02:00
Gleb Natapov
20d2725ed9 core: shared_ptr add noexcept
Add missing noexcepts. Those on constructors are needed to be able to
store shared pointers in growable containers efficiently.
2015-01-12 17:29:02 +02:00
Pekka Enberg
fa8d120d70 core: Fix shared_ptr pointer casts
Fix compilation errors in the shared_ptr pointer cast functions and
update shared_ptr constructor to take shared_ptr_count_base.

Suggested by Avi.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-01-07 13:50:59 +02:00
Avi Kivity
66eea763bf shared_ptr: add comparison operators 2015-01-05 13:24:07 +02:00
Avi Kivity
7a317f78a2 shared_ptr: be friend to self
Needed for converting constructor.
2015-01-05 13:24:06 +02:00
Avi Kivity
c7d7494a65 shared_ptr: add some documentation 2015-01-05 10:39:35 +02:00
Avi Kivity
b6d76ed650 shared_ptr: add polymorphic-capable shared pointer
At the cost of doubling the pointer size, this shared_ptr is polymorphic
and can be upcast to a base class.
2015-01-04 23:15:58 +02:00
Avi Kivity
87f63f7b90 shared_ptr: rename to lw_shared_ptr (for light-weight)
The current shared_ptr implementation is efficient, but does not support
polymorphic types.

Rename it in order to make room for a polymorphic shared_ptr.
2015-01-04 22:38:49 +02:00
Avi Kivity
33518ea9d0 shared_ptr: fix uninitialized enable_shared_from_this ref count
Caused immediate leak.
2015-01-01 14:29:27 +02:00
Avi Kivity
3cecef365f shared_ptr: implement enable_shared_from_this<>
Mirrors std::enable_shared_from_this<>.
2014-12-29 11:02:31 +02:00
Tomasz Grabiec
0b4ee2ff60 core: advertise element type in shared_ptr<>
Other smart pointers also do that. Will help foreign_ptr<>.
2014-11-11 13:52:23 +02:00
Asias He
8b737c95e5 core: Add use_count for shared_ptr
This is useful when debugging shared_ptr.
2014-10-22 11:40:18 +03:00
Tomasz Grabiec
319ae0b530 core: add shared_ptr::operator=(T&&)
Allows to move an item directly into existing shread_ptr.
2014-10-15 15:59:42 +02:00
Avi Kivity
e659c7fafc Add specializations to make_shared 2014-09-03 16:22:27 +03:00
Avi Kivity
48f570f57c core: add shared_ptr<> smart pointer
Just like std::shared_ptr<>, except no atomics.
2014-09-02 19:08:52 +03:00