Where to initialize static const member in c++17 or newer?
问题 The questions is where to initialize static const member in c++17 or newer? Please consider the following two solutions for initializing a static const member in c++: Solution 1 (for c++14 or older): //foo.h: #include <iostream> struct foo{ static const std::string ToBeInitialized; }; //foo.cpp #include <iostream> #include "foo.h" const std::string foo::ToBeInitialized{"with a value"}; Solution 2 (for c++17 or newer): //foo.h: #include <iostream> struct foo{ inline static const std::string