SUNphi  1.0
Aliver.hpp
Go to the documentation of this file.
1 #ifndef _ALIVER_HPP
2 #define _ALIVER_HPP
3 
4 /// \file Aliver.hpp
5 ///
6 /// \brief Makes sure that the library is started
7 
8 namespace SUNphi
9 {
10  /// Helper to make sure that the initializing functions are referenced
11  int aliverHelper();
12 
13  /// Makes sure that the library is started
14  ///
15  /// Elaborates on the approach of https://stackoverflow.com/a/43352830
16  /// 1) takes the returned value of the helper, which is never used
17  /// 2) static ensures that every TU gets a separate instance
18  static int makeSureAliverIsReferenced=
19  aliverHelper();
20 
21  class Aliver;
22 
23  extern Aliver aliver;
24 }
25 
26 #endif