i have a lot of classes with static member variables without inline, and now i am refactoring them. Are inline static member variables slower than their counterparts? (i read that inlined METHODS are bad for performance, is it same with VARIABLES)
Which one i should prefer:
with inline:
class AClass
{
public:
//standart data types
static inline int LastStaticIndex = 0;
static inline bool Log_AllEnabled = false;
//a struct (in microsoft case "CRITICAL_SECTION")
static inline Mutex mutex;
//a struct with member with dynamic size
static inline std::string Text = "testing";
};
without inline:
class AClass
{
public:
//standart data types
static int LastStaticIndex;
static bool Log_AllEnabled;
//a struct (in microsoft case "CRITICAL_SECTION")
static Mutex mutex;
//a struct with member with dynamic size
static std::string Text;
};
//cpp file, (or even same header file)
int AClass::LastStaticIndex = 0;
bool AClass::Log_AllEnabled = false;
Mutex AClass::mutex = Mutex();
std::string AClass::Text = "testing";