Commit 77996d8
reflection: generalize registration, rename it register_classes
`use_classes_in<^^ns, Registry>` took one namespace and one registry.
`register_classes<...>` takes four groups of non-type arguments, each
optional, in enforced order - namespaces to scan, classes to register,
one `register_classes_opts` value, registries (as reflections now,
since the pack is `auto...`) - and registers in every listed registry.
Listed classes are dispatch roots: registered whether a method
dispatches on them or not, along with the scanned classes deriving
from them. Classes with no namespace disable the scan - exactly the
listed classes are registered, their inheritance lattice read from
reflection and flattened over unlisted intermediates. Scans now skip
`boost` as well as `std` - worth ~0.2s per TU on a scan of `^^::` in a
Boost.Test TU, and reversible with `scan_boost`/`scan_std`;
`no_recurse` keeps a scan out of nested namespaces. The options live
in a namespace rather than an enum class so a using-directive can make
the terse spellings available.
With no namespace and no class at all, the enclosing namespace is
scanned. Three routes lead there, all resting on P2996's call-site
evaluation of `access_context::current()`: the default template
argument covers `register_classes<>`; a `detail::scope_marker` that
`BOOST_OPENMETHOD_REGISTER_CLASSES` always prepends covers every macro
form, registry-only and options-only included; and the public
`current_namespace()` helper covers bare-template argument lists,
which the template itself cannot capture - a static_assert points
there. The macro no longer pastes `^^`; the caller writes it.
The two new compile-fail tests produce the expected diagnostic via
`#error` when reflection is off, so they pass under every
configuration with no build-file changes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDTJyUvPbFj23o8zVcuvHt1 parent 427f481 commit 77996d8
46 files changed
Lines changed: 883 additions & 140 deletions
File tree
- doc/modules/ROOT/pages
- include/boost/openmethod
- detail
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
160 | 174 | | |
161 | 175 | | |
162 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | | - | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments