This looks to me not thread safe since it uses static member variables.
It uses static constant member variables ("constant variables"... ^^ let's say "static member constants"). What is often said as "not thread safe" is static mutable variables ("mutable" meaning "non-const", not necessarily defined with the keyword mutable
).
You can sometimes see code with enum { value = 0 };
(or 1
) instead of static const bool value = false;
(or true
), but it's often considered a "hack" and you lose the bool
type.
Also, in C++11, use std::is_same
from the header <type_traits>
directly.