Boost logo

Boost :

Subject: Re: [boost] inline specifier within in class definition
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-05-05 09:39:44


Simonson, Lucanus wrote:

> If, by some strange coincidence, you happen to be implementing a non-template class and leave out the inline keyword when defining a static member function in the header file as part of the class definition, or any other kind of function, for that matter, you end up with a multiple function definition link-time error when the header is included in multiple execution units. Specifying the inline keyword forces the compiler to make the function signature a weak symbol and eliminates the link time error.

Defining member functions directly within the class definition already
has that effect.
Such functions are implicitly inline according to the C++ standard.

The "inline" keyword is useless there as far as the C++ standard is
concerned.
Now, maybe some compilers consider specifying it explicitly an
additional hint with regards to inlining, and that's the real question
of that thread.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk