12#ifndef ZEROERR_DISABLE_DBG_MARCO
13#define dbg(...) zeroerr::DebugExpr(__FILE__, __LINE__, __func__, #__VA_ARGS__, __VA_ARGS__)
15#define dbg(...) (__VA_ARGS__)
20template <
class T1,
class... T>
34template <
typename... Args>
36 return std::get<
sizeof...(Args) - 1>(std::tie(args...));
44template <
typename... T>
45auto DebugExpr(
const char* file,
unsigned line,
const char* func,
const char* exprs, T... t) ->
46 typename last<T...>::type {
58 for (
unsigned i = 0; i <
sizeof...(T); ++i) {
size_type find_last_of(char value, size_type pos=npos) const noexcept
Definition string.cpp:109
String substr(size_type pos=0, size_type count=npos) const
Definition string.cpp:127
static constexpr size_type npos
Definition string.h:47
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_POP
Definition config.h:283
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
Definition config.h:235
Definition assert_text.cpp:5
const char * FgCyan
Definition color.cpp:48
auto DebugExpr(const char *file, unsigned line, const char *func, const char *exprs, T... t) -> typename last< T... >::type
DebugExpr is a function to print any type of variable with its type name. It is used by dbg macro.
Definition dbg.h:45
const char * Dim
Definition color.cpp:36
const char * FgGreen
Definition color.cpp:44
Printer & getStderrPrinter()
Definition print.cpp:14
auto get_last(Args &&... args) -> typename last< Args... >::type
get_last is a function to get the last argument of a variadic template. It is used by DebugExpr.
Definition dbg.h:35
const char * Reset
Definition color.cpp:34
A functor class Printer for printing a value of any type.
Definition print.h:74
StringBuffer & os
Definition print.h:121
static zeroerr::String type(const T &t)
Definition print.h:126
const char * line_break
Definition print.h:120
T1 type
Definition dbg.h:27
typename last< T... >::type type
Definition dbg.h:22