L
Litvinov Sergey
My problem is the following one.
I have a huge number of objects of base class:
class Base {
public:
virtual void
method();
}
And a derived class:
class Derived : publcic Base {
public:
virtual void
method();
}
Sometime I have no objects of Derived class and in those cases
I would like to get rid of polymorphism overhead. (speed is crucial
for
me). It is OK for me to have
a separate binary to handle those cases. But the only design I came up
with is
with preprocessor to "separate" virtual keyword in class definition
class Base {
#ifdefine NOPOLYMORPHISM
void
method();
#else
virtual void
method();
#endif
}
and the part of the program where the concrete type of the objects is
defined should
be also modified.
Is there any better way to do that?
I have a huge number of objects of base class:
class Base {
public:
virtual void
method();
}
And a derived class:
class Derived : publcic Base {
public:
virtual void
method();
}
Sometime I have no objects of Derived class and in those cases
I would like to get rid of polymorphism overhead. (speed is crucial
for
me). It is OK for me to have
a separate binary to handle those cases. But the only design I came up
with is
with preprocessor to "separate" virtual keyword in class definition
class Base {
#ifdefine NOPOLYMORPHISM
void
method();
#else
virtual void
method();
#endif
}
and the part of the program where the concrete type of the objects is
defined should
be also modified.
Is there any better way to do that?