According to the C++ specification, are the following two classes equivalently defined?
class A
{
void f()
{
}
};
class B
{
inline void f()
{
The inline is optional in that case, yes. The compiler will know it's inline and not generate multiple instances of the function whenever the header is included.
As to whether its a good idea to leave it there - I don't really think so. It'd be better to give a detailed comment explaining why the function MUST be inlined (of which I can thin of only 2 reasons: either "it's a template" in which case out of lining is impossible, or "performance" in which case I'd want to see some supporting evidence, rather than the "it has to perform better because it's inline" that I've seen in some places.