You must declare it inline from inside the class declaration. You should declare it like this:
class CDraw
{
public:
inline void DrawFast();
};
inline void CDraw::DrawFast()
{
pDDraw->FastBlt(...);
}
Keep in mind that the function body for inline functions must be in the .h file with the class declaration, because the compiler needs a copy of the function every time it goes through the header file, while with ordinary functions it just uses the identifier name (i.e., CDraw::DrawFast()) so it would be okay for the function to be in a different file from the class declaration.
Also, you should never force a function inline. If the compiler outlines it (yes, that''s the technical term), then it is because the increase in size does not justify the increase in speed. Let the compiler optimize it; it will work something like taking the ratio of the time it takes to jump to the function code over the time it takes to execute the function code. Also, if you are calling the function from within a loop (where the calling time would become more important), the compiler will pick up on this and inline it.
Let the compiler play around with it.
(If it helps you to know, the C++ standard allows the compiler to choose which functions should be inlined, even though you specify the inline keyword. "inline" is what is called an optimization hint, which is like waving a flag saying "hey you! this could be optimized!" but might still be incorrect.)
-
null_pointerSabre Multimedia