November 1999
Intermediate to advanced
336 pages
6h 29m
English
Inlining replaces method calls with a macro-like expansion of the called method within the calling method. There are two mechanisms for specifying an intent to inline. One is to prefix the method definition with the reserved word inline, and the other is to define the method within the declaration header. A code sample make this easier to demonstrate:
Class GatedInt {
int x;
public:
int get () {
return x;
}
void set (int arg) {
x = arg;
}
}
GatedInt::get and GeatedInt::set will both be inlined because they are defined within the declaration. Conversely, the methods to be inlined can be defined outside the class declaration but within the header file or within a file included by the header file.
Class GatedInt { int x; public: ...Read now
Unlock full access