c++ - Will inline speed up void a(string b) { cout << b; } -
for assignment, we're supposed write 2 methods handling outputs. 1 outputting strings, , 1 integers.
basically have 2 methods calling method:
void theclass::displaystring(string str){ cout << str; } void theclass::displaynumber(int n) { cout << n; } will inline speed things saving overhead not calling yet function or create more in regards namespaces , such cout?
inline void theclass::displaystring(string str) { cout << str; } inline void theclass::displaynumber(int n) { cout << n; }
namespaces don't have it.
you won't see benefit here 1 simple reason: function small i'd expect compiler inlining anyway.
remember, keyword inline hint not directive, , can let toolchain decide when inline. it's @ that.
Comments
Post a Comment