Hi,
If you have a method and you want to give the compiler a hint that it is a good idea to inline it, you currently have 2 solutions. The first one is to define the methods when you declare your class:
class Vector { private: double* data_; double* size_; double* capacity_; public: double& operator[](int k) { return data_[k]; } ... }
As this method might reduce readability, another solution is to use the inline keyword and define the method out of class:
class Vector { private: double* data_; double* size_; double* capacity_; public: inline double& operator[](int k); ... } double& Vector::operator[](int k) { return data_[k]; }
This makes the code more readable (at least I prefer it). Reading my STL implementation, I found that they use a mix of the two. Some methods (those which I think should really be inlined) are defined in the class, and others are defined out of class with the inline keyword. The file also begins with a commented declaration of the class.
So my question is the following. Do Intel compilers are more likely to inline a member function that is declared inside the class than a member function declared out of class with the inline keyword?