
JOAQUIN LOPEZ MUÑOZ wrotes
The destruction order is the correct one:
static_var2 static_var1 holder
I guess you're being misled by the definition of the initializer fwinit: Its presence forces holder initialization *unless* this initialization has already taken place, which is the case here, due to the previous definition of static_var1. So, your code is entirely equivalent to
static flyweight<std::string> static_var1("safe_or_unsafe1"); static flyweight<std::string> static_var2("safe_or_unsafe2");
You are right. The destruction order is correct. I have associated the static initialization of the holder and the fwinit variable and have forgotten that the static_var1 initialization forces the static initialization of the holder. Sorry --------------------------- Vicente Juan Botet Escriba