Why is the boost :: shared_ptr & # 8594; not declared inline?
Since boost::shared_ptr
one would call very often and just return a pointer, isn't the operator a ->
good candidate for inlined
?
T * operator-> () const // never throws
{
BOOST_ASSERT(px != 0);
return px;
}
Will a good compiler be automatic inline
anyway?
Should I lose sleep over this? :-)
a source to share
Note that shared_ptr
is a template class , so its member functions are actually function templates .
Since they are not export
ed, they must not only be declared , but also defined in all translation units where they are used, just like a defined function with a storage specifier inline
.
In a sense, it template
also means inline
.
a source to share