I always try to keep implementation outside of headers, so for templates and inlined functions, I usually do something like this
// File.h
inline bool foo()
#include "File.hpp"
// File.hpp
inline bool foo()
{
return 1;
}
My question is, what does the C++ specification have to say about repeating the inline keyword for the actual implementation of the function? (as shown in this example)
I don't really want to do that as it gets messy with lots and lots of functions, and while my compiler doesn't complain, I wonder if the compiler still accepts the inline hint.
Anyone know?
inline
keyword is mostly there to tell the compiler to take some precautions to make it possible to inline the function (if it chooses to do so) without multiple definitions etc. This would make the keyword more an artefact of early C++ compiler implementations more than anything else. – Royceroyd