More C++ Idioms/Runtime Static Initialization Order Idioms

< More C++ Idioms

Runtime Static Initialization Order Idioms

Intent

Control the order of initialization and destruction of non-local static objects across compilation units that are otherwise ordered in an implementation dependent manner.

Motivation

Solution and Sample Code

The following idioms are commonly used to control the order of initialization of static objects.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.