I know that declaring a function (normal function not a method inside a class) as inline is a good practice when the function definition is small for performance and it save time for the compilation. But how about inline methods inside a class
I don’t understand the concept of inline methods inside a class? How to define them and how they work.
I know that declaring a function (normal function not a method inside a class)
Share
Both syntaxes for inlining functions (using explicit
inlineand defining member-function inside class definition) provides only hint about inlining for compiler. From performance point of view, they are equal.In case of defining a member-function inside a class declaration, the readability of the latter should be of your main concern: it really hurts to litter class interface with multiple line of implementation details. So avoid doing that if your member-function is more than one statement:
return stuffor simple forwarding should be OK, but usually no more than that.