devirtualization Questions
1
struct base {
virtual void vcall() = 0;
};
struct foo final : base {
void vcall() final;
};
void call_base(base& b) {
b.vcall();
}
void call_foo(foo& f) {
call_base(f);
}
void call_...
Rateable asked 19/6, 2023 at 21:4
2
Solved
devirtualize: to change a virtual/polymorphic/indirect function call into a static function call due to some guarantee that the change is correct -- source: myself
Given a simple trait object, &a...
Kiethkiev asked 14/12, 2020 at 13:59
3
Solved
Consider the following code:
struct A {
virtual A& operator+=(const A& other) noexcept = 0;
};
void foo_inner(int *p) noexcept { *p += *p; }
void foo_virtual_inner(A *p) noexcept { *p +=...
Hurried asked 1/4, 2019 at 22:42
1
Solved
I wrote this short program to see how devirtualization would work. The compiler should be able to deduce the correct type:
#include <iostream>
using std::cout;
using std::endl;
class Base
...
Mure asked 20/12, 2015 at 11:34
1
© 2022 - 2024 — McMap. All rights reserved.