File: vptr_map.adoc

package info (click to toggle)
boost1.90 1.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 593,120 kB
  • sloc: cpp: 4,190,908; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,774; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (56 lines) | stat: -rw-r--r-- 1,384 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

## vptr_map

### Synopsis

```c++
namespace boost::openmethod::policies {

### Synopsis

template<class Policy, class MapAdaptor = mp11::mp_quote<std::unordered_map>>
class vptr_map : public extern_vptr {
  public:
    template<typename ForwardIterator>
    static auto register_vptrs(ForwardIterator first, ForwardIterator last) -> void;

    template<class Class>
    static auto dynamic_vptr(const Class& arg) -> const vptr_type&;
};

}
```

### Description

`vptr_map` is an implementation of `external_vptr that stores the pointers to
the v-tables in a map. If `Policy` contains `indirect_vptr`, a level of
indirection is added, making the policy usable in presence of dynamic loading.

`Policy` is the policy containing the policy.

`MapAdaptor` is a Boost.Mp11 quoted metafunction that returns a map type.

### Members

#### register_vptrs

```c++
template<typename ForwardIterator>
auto register_vptrs(ForwardIterator first, ForwardIterator last) -> void;
```

Stores the pointers to v-tables in a _Map_.

#### dynamic_vptr

```c++
template<class Class>
auto dynamic_vptr(const Class& object) -> const vptr_type&;
```

Returns a pointer to the v-table for `object` (by reference).

If _Policy_ contains the `runtime_checks` policy, checks if _Class_ is
registered. If it is not, and _Policy_ contains a `error_handler` policy, calls
its `error` function; then calls `abort`.