Boost C++ Libraries: Ticket #11670: Boost intrusive constructors should be constexpr https://svn.boost.org/trac10/ticket/11670 <p> Boost intrusive constructors should be marked constexpr. Doing so would allow for their use in static variables without SIOF. As an example consider this program that uses a simple linked list </p> <p> <a class="ext-link" href="http://ideone.com/O5YWM8"><span class="icon">​</span>http://ideone.com/O5YWM8</a> </p> <p> because the <a class="missing wiki">LinkedList</a> constructor is not constexpr, the variable gets initialized in file declaration order -- after my_crazy_variable. Therefore even though my_crazy_variable's ctor pushes something on to the list, it gets lost when the list is initialized and the program crashes due to being unable to pop a value. </p> <p> However, if you declare <a class="missing wiki">LinkedList</a>'s constructor constexpr the list is initialized in the zero initialization phase (<a class="ext-link" href="http://en.cppreference.com/w/cpp/language/initialization#Non-local_variables"><span class="icon">​</span>http://en.cppreference.com/w/cpp/language/initialization#Non-local_variables</a>). This means that the linked list can be used in other constructors without worrying about initialization order. </p> <p> While my example is obviously not a sane use case, imagine a linked list that registers all live Widget objects. if somebody creates a widget during static initialization they could encounter the same problem. </p> <p> A side benefit to doing this is that code size is reduced as the code to initialize the linked list is not created </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11670 Trac 1.4.3