Empirical
debug.h
Go to the documentation of this file.
1 
11 #ifndef EMP_DEBUG_H
12 #define EMP_DEBUG_H
13 
14 #include <iostream>
15 #include <set>
16 #include <string>
17 #include <type_traits>
18 
19 #define EMP_DEBUG_PRINT(...) std::cout << "[" << #__VA_ARGS__ << "] = " << __VA_ARGS__ << std::endl
20 
21 namespace emp {
22 
25 #ifdef NDEBUG
26  #define BlockRelease(BLOCK) static_assert(!BLOCK, "Release blocked due to debug material.")
27 #else
28  #define BlockRelease(BLOCK)
29 #endif
30 
32 #ifdef NDEBUG
33 #define EMP_DEBUG(...)
34 #else
35 #define EMP_DEBUG(...) __VA_ARGS__
36 #endif
37 
39  static void Depricated(const std::string & name, const std::string & desc="") {
40  static std::set<std::string> name_set;
41  if (name_set.count(name) == 0) {
42  std::cerr << "Deprication WARNING: " << name << std::endl;
43  if (desc != "") std::cerr << desc << std::endl;
44  name_set.insert(name);
45  }
46  }
47 
48 }
49 
50 #endif
static const PrintStr endl("<br>")
Pre-define emp::endl to insert a "<br>" and thus acting like a newline.
If we are in emscripten, make sure to include the header.
Definition: array.h:37
static void Depricated(const std::string &name, const std::string &desc="")
Depricated() prints its contents exactly once to notify a user of a depricated function.
Definition: debug.h:39