
----- Mensaje original ----- De: "vicente.botet" <vicente.botet@wanadoo.fr> Fecha: Domingo, Enero 27, 2008 10:42 pm Asunto: Re: [boost] [review] Review of Flyweight library started January21 and still running!: static flyweights Para: boost@lists.boost.org
Hi again
I surelly mis something from the standard C++. I'm asking what happens if we declare static flyweight as
static flyweight<std::string> static_var1("safe_or_unsafe1"); static flyweight<std::string>::initializer fwinit; static flyweight<std::string> static_var2("safe_or_unsafe2");
Which is the destruction order between static_var1, static_var2 and the static holder of flyweight<std::string>?
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"); Joaquín M López Muñoz Telefónica, Investigación y Desarrollo