Reputation: 142
this may be a dumb question but im curious
when you define a function in a class in c++ it is automatically inlined.
what happens when you have 2 classes and class 'a' calls a function from class 'b', both functions having being defined in respective header files, are they both expanded as inline?
class a
{
void check_stuff()
{
b.do_stuff(param);
}
};
class b
{
type xyz;
public:
void do_stuff(type in)
{
xyz += in;
}
};
Upvotes: 0
Views: 45
Reputation: 238461
are they both expanded as inline?
Whether a function is inline and whether a function call is expanded inline are not directly tied to each other. Inline functions can be called without expansion and in some contexts non-inline functions can be expanded inline.
Yes, it is possible to expand a function inline within a function that was expanded inline.
Upvotes: 1