Subject: Re: [boost] inline specifier within in class definition
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-05-05 16:04:58
Mathias Gaunard wrote:
> 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.
Bingo! That's the question, indeed.
However, I haven't found definitive answer.
Anyway, I suppose it should easier for the authors to answer why
they used extra inline keyword in some of Boost libraries.
-- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org