Skip to content

Commit d24d1fe

Browse files
committed
inline static?
1 parent e7e6daa commit d24d1fe

3 files changed

Lines changed: 31 additions & 30 deletions

File tree

include/boost/openmethod/initialize.hpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,10 @@ struct generic_compiler {
164164
method_report report;
165165
};
166166

167-
const method*
168-
operator[](const detail::method_info& info) const {
167+
const method* operator[](const detail::method_info& info) const {
169168
auto iter = std::find_if(
170-
methods.begin(), methods.end(), [&info](const method& m) {
171-
return m.info == &info;
172-
});
169+
methods.begin(), methods.end(),
170+
[&info](const method& m) { return m.info == &info; });
173171

174172
if (iter != methods.end()) {
175173
return &*iter;
@@ -185,8 +183,8 @@ struct generic_compiler {
185183

186184
template<class Registry>
187185
auto operator<<(
188-
trace_type<Registry>& trace, const generic_compiler::class_& cls)
189-
-> trace_type<Registry>& {
186+
trace_type<Registry>& trace,
187+
const generic_compiler::class_& cls) -> trace_type<Registry>& {
190188
if constexpr (Registry::has_trace) {
191189
trace << type_name(cls.type_ids[0]);
192190
}
@@ -271,8 +269,8 @@ struct registry<Policies...>::compiler : detail::generic_compiler {
271269
static void select_dominant_overriders(
272270
std::vector<overrider*>& dominants, std::size_t& pick,
273271
std::size_t& remaining);
274-
static auto is_more_specific(const overrider* a, const overrider* b)
275-
-> bool;
272+
static auto
273+
is_more_specific(const overrider* a, const overrider* b) -> bool;
276274
static auto is_base(const overrider* a, const overrider* b) -> bool;
277275

278276
mutable detail::trace_type<registry> trace;
@@ -520,24 +518,27 @@ void registry<Policies...>::compiler::augment_methods() {
520518
meth_iter->info = &meth_info;
521519
meth_iter->vp.reserve(meth_info.arity());
522520
meth_iter->slots.resize(meth_info.arity());
523-
std::size_t param_index = 0;
524521

525-
for (auto ti : range{meth_info.vp_begin, meth_info.vp_end}) {
526-
auto class_ = class_map[rtti::type_index(ti)];
527-
if (!class_) {
528-
++trace << "unknown class " << ti << "(" << type_name(ti)
529-
<< ") for parameter #" << (param_index + 1) << "\n";
530-
unknown_class_error error;
531-
error.type = ti;
522+
{
523+
std::size_t param_index = 0;
532524

533-
if constexpr (has_error_handler) {
534-
error_handler::error(error);
525+
for (auto ti : range{meth_info.vp_begin, meth_info.vp_end}) {
526+
auto class_ = class_map[rtti::type_index(ti)];
527+
if (!class_) {
528+
++trace << "unknown class " << ti << "(" << type_name(ti)
529+
<< ") for parameter #" << (param_index + 1) << "\n";
530+
unknown_class_error error;
531+
error.type = ti;
532+
533+
if constexpr (has_error_handler) {
534+
error_handler::error(error);
535+
}
536+
537+
abort();
535538
}
536539

537-
abort();
540+
meth_iter->vp.push_back(class_);
538541
}
539-
540-
meth_iter->vp.push_back(class_);
541542
}
542543

543544
if (rtti::type_index(meth_info.return_type_id) !=
@@ -1092,9 +1093,9 @@ void registry<Policies...>::compiler::write_global_data() {
10921093
std::copy(m.strides.begin(), m.strides.end(), strides_iter);
10931094

10941095
if constexpr (has_trace) {
1095-
++trace << rflush(4, dispatch_data.size()) << " "
1096-
<< " method #" << m.dispatch_table[0]->method_index
1097-
<< " " << type_name(m.info->method_type_id) << "\n";
1096+
++trace << rflush(4, dispatch_data.size()) << " " << " method #"
1097+
<< m.dispatch_table[0]->method_index << " "
1098+
<< type_name(m.info->method_type_id) << "\n";
10981099
indent _(trace);
10991100

11001101
for (auto& entry : m.dispatch_table) {
@@ -1115,8 +1116,8 @@ void registry<Policies...>::compiler::write_global_data() {
11151116

11161117
for (auto& m : methods) {
11171118
indent _(trace);
1118-
++trace << "method #"
1119-
<< " " << type_name(m.info->method_type_id) << "\n";
1119+
++trace << "method #" << " " << type_name(m.info->method_type_id)
1120+
<< "\n";
11201121

11211122
for (auto& overrider : m.specs) {
11221123
if (overrider.next) {

include/boost/openmethod/inplace_vptr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class inplace_vptr_aux<Class, Base, false> : inplace_vptr_derived {
113113
} // namespace detail
114114

115115
template<typename...>
116-
class inplace_vptr;
116+
struct inplace_vptr;
117117

118118
template<class Class>
119119
struct inplace_vptr<Class>

test/test_static_rtti.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ BOOST_OPENMETHOD_CLASSES(Animal, Dog, Cat);
3131
BOOST_OPENMETHOD(poke, (virtual_ptr<Animal>, std::ostream&), void);
3232

3333
BOOST_OPENMETHOD_OVERRIDE(
34-
poke, (virtual_ptr<Dog> dog, std::ostream& os), void) {
34+
poke, (virtual_ptr<Dog>, std::ostream& os), void) {
3535
os << "bark";
3636
}
3737

3838
BOOST_OPENMETHOD_OVERRIDE(
39-
poke, (virtual_ptr<Cat> cat, std::ostream& os), void) {
39+
poke, (virtual_ptr<Cat>, std::ostream& os), void) {
4040
os << "hiss";
4141
}
4242

0 commit comments

Comments
 (0)