dune-common  2.4.1-rc2
stdthread.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 
4 #ifndef DUNE_COMMON_STDTHREAD_HH
5 #define DUNE_COMMON_STDTHREAD_HH
6 
7 #include <dune/common/nullptr.hh>
8 #include <dune/common/unused.hh>
9 
10 namespace Dune
11 {
12 
13  // used internally by assertCallOnce for the actual check
14  void doAssertCallOnce(const char *file, int line, const char *function);
15 
18 
36  inline void assertCallOnce(const char *file = nullptr, int line = -1,
37  const char *function = nullptr)
38  {
39  // make sure to call this only the first time this function is invoked
40  static const bool DUNE_UNUSED works
41  = (doAssertCallOnce(file, line, function), true);
42  }
43 
46 
50 #define DUNE_ASSERT_CALL_ONCE() \
51  ::Dune::assertCallOnce(__FILE__, __LINE__, __func__)
52 
53 } // namespace Dune
54 
55 #endif // DUNE_COMMON_STDTHREAD_HH
#define DUNE_UNUSED
Definition: unused.hh:12
void doAssertCallOnce(const char *file, int line, const char *function)
Definition: stdthread.cc:40
Fallback implementation of the nullptr object in C++0x.
void assertCallOnce(const char *file=nullptr, int line=-1, const char *function=nullptr)
Make sure call_once() works and provide a helpful error message otherwise.
Definition: stdthread.hh:36
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
Dune namespace.
Definition: alignment.hh:9