Skip to content

Commit 867dd0a

Browse files
committed
smart_pointers.adoc: mention intrusive_ptr
1 parent b7c52f7 commit 867dd0a

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

doc/modules/ROOT/pages/smart_pointers.adoc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,24 @@ plain reference or pointer.
3232

3333
The library provides aliases for standard smart pointers:
3434

35-
- `unique_virtual_ptr<Class>` is an alias for `virtual_ptr<std::unique_ptr<Class>>`
35+
- cpp:unique_virtual_ptr<Class>[] is an alias for `virtual_ptr<std::unique_ptr<Class>>`
3636
37-
- `shared_virtual_ptr<Class>` is an alias for `virtual_ptr<std::shared_ptr<Class>>`
37+
- cpp:shared_virtual_ptr<Class>[] is an alias for `virtual_ptr<std::shared_ptr<Class>>`
38+
39+
Support for `boost::intrusive_ptr` is also available:
40+
41+
- cpp:boost_intrusive_virtual_ptr<Class>[] is an alias for `virtual_ptr<boost::intrusive_ptr<Class>>`
3842
3943
The standard library provides `std::make_unique` and `std::make_shared` to
4044
create smart pointers. They are convenient, robust in presence of exceptions,
4145
and, in the case of `std::shared_ptr`, more efficient. OpenMethod provides
4246
these counterparts:
4347

44-
- `make_unique_virtual_ptr<Class>(...)`
48+
- cpp:make_unique_virtual[]
49+
50+
- cpp:make_shared_virtual[]
4551
46-
- `make_shared_virtual_ptr<Class>(...)`
52+
- cpp:make_boost_intrusive_virtual[]
4753
4854
Since these functions create the object, they know its exact type with
4955
certainty. Thus they don't need to perform a hash table lookup to find the
@@ -56,7 +62,9 @@ likely to be used together.
5662

5763
Smart `virtual_ptr`{empty}s are implemented in their own headers, found in the
5864
`interop` subdirectory. For example, support for `std::unique_ptr` is provided
59-
in `<boost/openmethod/interop/std_unique_ptr.hpp>`. `<boost/openmethod.hpp>`
65+
in `<boost/openmethod/interop/std_unique_ptr.hpp>`, and support for
66+
`boost::intrusive_ptr` is provided in
67+
`<boost/openmethod/interop/boost_intrusive_ptr.hpp>`. `<boost/openmethod.hpp>`
6068
does not include smart pointer headers, so they must be included explicitly.
6169

6270
Here is a variation of the AST example that uses dynamic allocation and unique

0 commit comments

Comments
 (0)