Boost logo

Boost :

Subject: [boost] inline specifier within in class definition
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-05-03 17:04:25


Could anyone explain why some static member functions defined within
class definitions are specified with inline keyword?

For instance, in boos/serialization/export.hpp

template <class Archive, class Serializable>
struct export_impl
    inline static void enable_load(mpl::false_) {}
    inline static void enable_save(mpl::false_) {}

AFAIU what the C++ Standard says in chapter "9.3 Member functions",
it should be enough to define a member function in its class
definition, "in which case it is an inline member function".

On the other side, the standard also uses this technique,
for instance in example presented in " numeric_limits
specializations". I'm having problem with catching what's the
rationale of using extra inline specifier.

I was trying to find answer in the guidelines, but it seems
it isn't explained.

Best regards,

Mateusz Loskot,
Charter Member of OSGeo,

Boost list run by bdawes at, gregod at, cpdaniel at, john at