Skip to content

Commit baff0d3

Browse files
committed
with_vptr -> inplace_vptr
1 parent 0416b9b commit baff0d3

14 files changed

Lines changed: 106 additions & 101 deletions

doc/dynamic_loading.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ called to rebuild the dispatch tables.
88

99
This leads to a problem: any `virtual_ptr` in existence before `initialize` is
1010
called again becomes invalid. This also applies to vptrs that are stored inside
11-
objects by `with_vptr`.
11+
objects by `inplace_vptr`.
1212

1313
NOTE: This applies only to cases where a dynamic library adds to an _existing_
1414
policy. Even if the dynamic library itself uses open-methods, for example as an

doc/html/index.html

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ <h1>Boost.OpenMethod</h1>
610610
<li><a href="#virtual_ptr_description_4">Description</a></li>
611611
</ul>
612612
</li>
613-
<li><a href="#virtual_ptr_with_vptr">with_vptr</a>
613+
<li><a href="#virtual_ptr_inplace_vptr">inplace_vptr</a>
614614
<ul class="sectlevel3">
615615
<li><a href="#virtual_ptr_synopsis_5">Synopsis</a></li>
616616
<li><a href="#virtual_ptr_description_5">Description</a></li>
@@ -1961,17 +1961,17 @@ <h3 id="tutorials_alternatives_to_virtual_ptr">Alternatives to virtual_ptr</h3>
19611961
</table>
19621962
</div>
19631963
<div class="paragraph">
1964-
<p>The <code>with_vptr</code> CRTP class automates the creation and management of embedded
1964+
<p>The <code>inplace_vptr</code> CRTP class automates the creation and management of embedded
19651965
vptrs.</p>
19661966
</div>
19671967
<div class="listingblock">
19681968
<div class="content">
1969-
<pre class="rouge highlight"><code data-lang="c++">#include &lt;boost/openmethod/with_vptr.hpp&gt;
1969+
<pre class="rouge highlight"><code data-lang="c++">#include &lt;boost/openmethod/inplace_vptr.hpp&gt;
19701970

1971-
class Animal : public boost::openmethod::with_vptr&lt;Animal&gt; {
1971+
class Animal : public boost::openmethod::inplace_vptr&lt;Animal&gt; {
19721972
};
19731973

1974-
class Cat : public Animal, public boost::openmethod::with_vptr&lt;Cat, Animal&gt; {
1974+
class Cat : public Animal, public boost::openmethod::inplace_vptr&lt;Cat, Animal&gt; {
19751975
};
19761976

19771977
BOOST_OPENMETHOD(poke, (std::ostream&amp;, virtual_&lt;Animal&amp;&gt;), void);
@@ -1989,11 +1989,11 @@ <h3 id="tutorials_alternatives_to_virtual_ptr">Alternatives to virtual_ptr</h3>
19891989
</div>
19901990
</div>
19911991
<div class="paragraph">
1992-
<p>If <code>with_vptr</code> is passed only the class being defined, it adds a vptr to it, and
1992+
<p>If <code>inplace_vptr</code> is passed only the class being defined, it adds a vptr to it, and
19931993
defines a <code>boost_openmethod_vptr</code> friend function. If more classes are passed,
19941994
they must be the direct bases of the class potentially involved in open-method
19951995
calls. Its constructor and destructor set the vptr to point to the v-table for
1996-
the class. <code>with_vptr</code> also takes care of registering the classes, so this time
1996+
the class. <code>inplace_vptr</code> also takes care of registering the classes, so this time
19971997
the call to <code>BOOST_OPENMETHOD_CLASSES</code> is not needed.</p>
19981998
</div>
19991999
</div>
@@ -2787,7 +2787,7 @@ <h3 id="tutorials_dynamic_loading">Dynamic Loading</h3>
27872787
<div class="paragraph">
27882788
<p>This leads to a problem: any <code>virtual_ptr</code> in existence before <code>initialize</code> is
27892789
called again becomes invalid. This also applies to vptrs that are stored inside
2790-
objects by <code>with_vptr</code>.</p>
2790+
objects by <code>inplace_vptr</code>.</p>
27912791
</div>
27922792
<div class="admonitionblock note">
27932793
<table>
@@ -3131,7 +3131,7 @@ <h5 id="ref_boostopenmethodunique_hpp">&lt;boost/openmethod/unique_.hpp&gt;</h5>
31313131
</div>
31323132
</div>
31333133
<div class="sect4">
3134-
<h5 id="ref_boostopenmethodwith_vptr_hpp">&lt;boost/openmethod/with_vptr.hpp&gt;</h5>
3134+
<h5 id="ref_boostopenmethodinplace_vptr_hpp">&lt;boost/openmethod/inplace_vptr.hpp&gt;</h5>
31353135
<div class="paragraph">
31363136
<p>Provides support for storing v-table pointers directly in objects, in the same
31373137
manner as native virtual functions.</p>
@@ -4811,29 +4811,29 @@ <h4 id="virtual_ptr_description_4">Description</h4>
48114811
</div>
48124812
</div>
48134813
<div class="sect2">
4814-
<h3 id="virtual_ptr_with_vptr">with_vptr</h3>
4814+
<h3 id="virtual_ptr_inplace_vptr">inplace_vptr</h3>
48154815
<div class="sect3">
48164816
<h4 id="virtual_ptr_synopsis_5">Synopsis</h4>
48174817
<div class="paragraph">
4818-
<p>Defined in &lt;boost/openmethod/with_vptr.hpp&gt;.</p>
4818+
<p>Defined in &lt;boost/openmethod/inplace_vptr.hpp&gt;.</p>
48194819
</div>
48204820
<div class="listingblock">
48214821
<div class="content">
48224822
<pre class="rouge highlight"><code data-lang="c++">namespace boost::openmethod {
48234823

48244824
template&lt;class Class, class Policy = BOOST_OPENMETHOD_DEFAULT_REGISTRY&gt;
4825-
class with_vptr {
4825+
class inplace_vptr {
48264826
protected:
4827-
with_vptr();
4828-
~with_vptr();
4827+
inplace_vptr();
4828+
~inplace_vptr();
48294829
friend auto boost_openmethod_vptr(const Class&amp; obj) -&gt; vptr_type;
48304830
};
48314831

48324832
template&lt;class Class, class Base, class... MoreBases&gt;
4833-
class with_vptr {
4833+
class inplace_vptr {
48344834
protected:
4835-
with_vptr();
4836-
~with_vptr();
4835+
inplace_vptr();
4836+
~inplace_vptr();
48374837
friend auto boost_openmethod_vptr(const Class&amp; obj) -&gt; vptr_type;
48384838
// if sizeof(MoreBases...) &gt; 0
48394839
};
@@ -4845,11 +4845,11 @@ <h4 id="virtual_ptr_synopsis_5">Synopsis</h4>
48454845
<div class="sect3">
48464846
<h4 id="virtual_ptr_description_5">Description</h4>
48474847
<div class="paragraph">
4848-
<p><code>with_vptr</code> is a CRTP class template that embeds and manages a vptr across a
4848+
<p><code>inplace_vptr</code> is a CRTP class template that embeds and manages a vptr across a
48494849
class hierarchy.</p>
48504850
</div>
48514851
<div class="paragraph">
4852-
<p>If <code>Class</code> has no <code>Bases</code>, <code>with_vptr</code> adds a <code>boost_openmethod_vptr</code> private
4852+
<p>If <code>Class</code> has no <code>Bases</code>, <code>inplace_vptr</code> adds a <code>boost_openmethod_vptr</code> private
48534853
member to <code>Class</code>. In either case, it sets the vptr to the v-table of <code>Class</code>
48544854
from <code>Policy</code>. It also creates a <code>boost_openmethod_vptr</code> friend function that
48554855
takes a a <code>const Class&amp;</code> and returns the embedded vptr.</p>
@@ -4861,7 +4861,7 @@ <h4 id="virtual_ptr_description_5">Description</h4>
48614861
ambiguities</p>
48624862
</div>
48634863
<div class="paragraph">
4864-
<p>As part of its implementation, <code>with_vptr</code> may also declare one or two free
4864+
<p>As part of its implementation, <code>inplace_vptr</code> may also declare one or two free
48654865
functions (<code>boost_openmethod_policy</code> and <code>boost_openmethod_bases</code>) at certain
48664866
levels of the hierarchy.</p>
48674867
</div>
@@ -4872,7 +4872,7 @@ <h4 id="virtual_ptr_members_4">Members</h4>
48724872
<h5 id="virtual_ptr_constructor_2">constructor</h5>
48734873
<div class="listingblock">
48744874
<div class="content">
4875-
<pre class="rouge highlight"><code data-lang="c++">with_vptr();</code></pre>
4875+
<pre class="rouge highlight"><code data-lang="c++">inplace_vptr();</code></pre>
48764876
</div>
48774877
</div>
48784878
<div class="paragraph">
@@ -4885,7 +4885,7 @@ <h5 id="virtual_ptr_constructor_2">constructor</h5>
48854885
<h5 id="virtual_ptr_destructor_2">destructor</h5>
48864886
<div class="listingblock">
48874887
<div class="content">
4888-
<pre class="rouge highlight"><code data-lang="c++">~with_vptr();</code></pre>
4888+
<pre class="rouge highlight"><code data-lang="c++">~inplace_vptr();</code></pre>
48894889
</div>
48904890
</div>
48914891
<div class="paragraph">
@@ -5612,7 +5612,7 @@ <h4 id="virtual_ptr_synopsis_15">Synopsis</h4>
56125612
<div class="sect3">
56135613
<h4 id="virtual_ptr_description_15">Description</h4>
56145614
<div class="paragraph">
5615-
<p><code>indirect_vptr</code> is a facet that makes <code>virtual_ptr</code>s and <code>with_vptr</code> use
5615+
<p><code>indirect_vptr</code> is a facet that makes <code>virtual_ptr</code>s and <code>inplace_vptr</code> use
56165616
pointers to pointers to v-tables, instead of straight pointers. As a
56175617
consequence, they remain valid after a call to <code>initialize</code>.</p>
56185618
</div>
@@ -6249,7 +6249,7 @@ <h4 id="virtual_ptr_description_25">Description</h4>
62496249
</div>
62506250
<div id="footer">
62516251
<div id="footer-text">
6252-
Last updated 2025-03-08 15:24:21 -0500
6252+
Last updated 2025-06-22 13:38:14 -0400
62536253
</div>
62546254
</div>
62556255
</body>
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11

2-
## with_vptr
2+
## inplace_vptr
33

44
### Synopsis
55

6-
Defined in <boost/openmethod/with_vptr.hpp>.
6+
Defined in <boost/openmethod/inplace_vptr.hpp>.
77

88
```c++
99
namespace boost::openmethod {
1010

1111
template<class Class, class Policy = BOOST_OPENMETHOD_DEFAULT_REGISTRY>
12-
class with_vptr {
12+
class inplace_vptr {
1313
protected:
14-
with_vptr();
15-
~with_vptr();
14+
inplace_vptr();
15+
~inplace_vptr();
1616
friend auto boost_openmethod_vptr(const Class& obj) -> vptr_type;
1717
};
1818

1919
template<class Class, class Base, class... MoreBases>
20-
class with_vptr {
20+
class inplace_vptr {
2121
protected:
22-
with_vptr();
23-
~with_vptr();
22+
inplace_vptr();
23+
~inplace_vptr();
2424
friend auto boost_openmethod_vptr(const Class& obj) -> vptr_type;
2525
// if sizeof(MoreBases...) > 0
2626
};
@@ -30,10 +30,10 @@ class with_vptr {
3030

3131
### Description
3232

33-
`with_vptr` is a CRTP class template that embeds and manages a vptr across a
33+
`inplace_vptr` is a CRTP class template that embeds and manages a vptr across a
3434
class hierarchy.
3535

36-
If `Class` has no `Bases`, `with_vptr` adds a `boost_openmethod_vptr` private
36+
If `Class` has no `Bases`, `inplace_vptr` adds a `boost_openmethod_vptr` private
3737
member to `Class`. In either case, it sets the vptr to the v-table of `Class`
3838
from `Policy`. It also creates a `boost_openmethod_vptr` friend function that
3939
takes a a `const Class&` and returns the embedded vptr.
@@ -43,7 +43,7 @@ function is also created. It returns one of the embedded vptrs (it doesn't
4343
matter which one, as they all have the same value). This is to resolve
4444
ambiguities
4545

46-
As part of its implementation, `with_vptr` may also declare one or two free
46+
As part of its implementation, `inplace_vptr` may also declare one or two free
4747
functions (`boost_openmethod_policy` and `boost_openmethod_bases`) at certain
4848
levels of the hierarchy.
4949

@@ -52,7 +52,7 @@ levels of the hierarchy.
5252
#### constructor
5353

5454
```c++
55-
with_vptr();
55+
inplace_vptr();
5656
```
5757

5858
Sets the vptr to the v-table for Class, obtained from `Policy`. If `Policy`
@@ -63,7 +63,7 @@ preserving the validity of the pointer across calls to `initialize`.
6363
#### destructor
6464

6565
```c++
66-
~with_vptr();
66+
~inplace_vptr();
6767
```
6868

6969
For each `Base`, sets the vptr to the v-table for that base.

doc/overview.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ virtual parameters.
8383
Provides support for using `std::unique_ptr` in place of plain pointers in
8484
virtual parameters.
8585

86-
#### <boost/openmethod/with_vptr.hpp>
86+
#### <boost/openmethod/inplace_vptr.hpp>
8787

8888
Provides support for storing v-table pointers directly in objects, in the same
8989
manner as native virtual functions.

doc/reference.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include::virtual_ptr.adoc[]
2727
include::virtual_traits.adoc[]
2828
include::use_classes.adoc[]
2929
include::virtual_.adoc[]
30-
include::with_vptr.adoc[]
30+
include::inplace_vptr.adoc[]
3131
include::abstract_policy.adoc[]
3232
include::domain.adoc[]
3333
include::basic_policy.adoc[]

doc/virtual_ptr_alt.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ NOTE: With this approach, classes need not be polymorphic. A virtual
5353
destructor might be needed for correct destruction of objects, but it is not
5454
required by the library.
5555

56-
The `with_vptr` CRTP class automates the creation and management of embedded
56+
The `inplace_vptr` CRTP class automates the creation and management of embedded
5757
vptrs.
5858

5959
[source,c++]
6060
----
61-
include::{exampledir}/virtual_.cpp[tag=with_vptr,indent=0]
61+
include::{exampledir}/virtual_.cpp[tag=inplace_vptr,indent=0]
6262
6363
int main() {
6464
boost::openmethod::initialize();
@@ -68,9 +68,9 @@ int main() {
6868
}
6969
----
7070

71-
If `with_vptr` is passed only the class being defined, it adds a vptr to it, and
71+
If `inplace_vptr` is passed only the class being defined, it adds a vptr to it, and
7272
defines a `boost_openmethod_vptr` friend function. If more classes are passed,
7373
they must be the direct bases of the class potentially involved in open-method
7474
calls. Its constructor and destructor set the vptr to point to the v-table for
75-
the class. `with_vptr` also takes care of registering the classes, so this time
75+
the class. `inplace_vptr` also takes care of registering the classes, so this time
7676
the call to `BOOST_OPENMETHOD_CLASSES` is not needed.

doc/vptr.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct indirect_vptr : facet {};
5555

5656
### Description
5757

58-
`indirect_vptr` is a facet that makes `virtual_ptr`{empty}s and `with_vptr` use
58+
`indirect_vptr` is a facet that makes `virtual_ptr`{empty}s and `inplace_vptr` use
5959
pointers to pointers to v-tables, instead of straight pointers. As a
6060
consequence, they remain valid after a call to `initialize`.
6161

example/virtual_.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <iostream>
77

88
#include <boost/openmethod.hpp>
9-
#include <boost/openmethod/with_vptr.hpp>
9+
#include <boost/openmethod/inplace_vptr.hpp>
1010
#include <boost/openmethod/compiler.hpp>
1111

1212
using boost::openmethod::virtual_;
@@ -68,26 +68,26 @@ BOOST_OPENMETHOD_CLASSES(Animal, Cat);
6868
// end::virtual_intrusive[]
6969
} // namespace virtual_intrusive
7070

71-
namespace with_vptr {
71+
namespace inplace_vptr {
7272

73-
// tag::with_vptr[]
73+
// tag::inplace_vptr[]
7474

75-
#include <boost/openmethod/with_vptr.hpp>
75+
#include <boost/openmethod/inplace_vptr.hpp>
7676

77-
class Animal : public boost::openmethod::with_vptr<Animal> {
77+
class Animal : public boost::openmethod::inplace_vptr<Animal> {
7878
};
7979

80-
class Cat : public Animal, public boost::openmethod::with_vptr<Cat, Animal> {
80+
class Cat : public Animal, public boost::openmethod::inplace_vptr<Cat, Animal> {
8181
};
8282

8383
BOOST_OPENMETHOD(poke, (std::ostream&, virtual_<Animal&>), void);
8484

8585
BOOST_OPENMETHOD_OVERRIDE(poke, (std::ostream & os, Cat& /*cat*/), void) {
8686
os << "hiss\n";
8787
}
88-
// end::with_vptr[]
88+
// end::inplace_vptr[]
8989

90-
} // namespace with_vptr
90+
} // namespace inplace_vptr
9191

9292
auto main() -> int {
9393
boost::openmethod::initialize();
@@ -105,7 +105,7 @@ auto main() -> int {
105105
}
106106

107107
{
108-
using namespace with_vptr;
108+
using namespace inplace_vptr;
109109
Cat cat;
110110
poke(std::cout, cat); // hiss
111111
}

include/boost/openmethod/core.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,8 @@ template<typename T, class Registry>
981981
struct valid_method_parameter<virtual_<T>, Registry>
982982
: std::bool_constant<
983983
has_vptr_fn<virtual_type<T, Registry>, Registry> ||
984-
Registry::rtti::template is_polymorphic<
985-
virtual_type<T, Registry>>> {};
984+
Registry::rtti::template is_polymorphic<virtual_type<T, Registry>>> {
985+
};
986986

987987
} // namespace detail
988988

0 commit comments

Comments
 (0)