My objects that are created and destroyed in one statement always do something required and it is often quite a lot. I've found it can be easier to debug when the debugger can use an identifier and there are more statements to put breakpoints on. Your example is probably an exceptional case and it given at C++ Core Guidelines somewhere.
I have some objects without names that are created and destroyed with one statement. This minimises the objects lifetime. CPPCheck tells me "Instance of 'xxx' object is destroyed immediately." as a style warning. I see this as good style.
I find that many potentialy inlined functions are defined in a .cpp file and called from another translation unit.
I can't see a negative side to it other than too much inlining. Someone thought it was worthwhile making constexpr functions implicitly declared inline.
To use inline on small functions is recommended by C++ Core Guidelines F5. It says inline isn't required for function templates but unless they are defined within a class definition they are not inplicitly declared inline.
Does cppcheck issue a warning for small functions that are not declared inline? I can't remember ever seeing one. It is an optimisation that has existed for a long time but is easily neglected. Many functions now are declared with constexpr which makes an implicit inline declaration from C++11.
I wasn't aware that noexcept was affecting this. It is interesting and possibly useful that the constructor can be declared noexcept since the argument object would throw during its construction before the construction of the NameContainer which now won't throw.
class NameContainer { public: explicit NameContainer(std::string /in file name/) noexcept; private: std::string inName_; }; NameContainer::NameContainer(std::string inName) noexcept : inName_(std::move(inName)) { }