forked from grantrostig/cpp_by_example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathglobal_entities.cpp
More file actions
27 lines (24 loc) · 1.03 KB
/
global_entities.cpp
File metadata and controls
27 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// copyright (c) Grant Rostig, grantrostig.com, Boost 1.0 license
#include "global_entities.hpp"
//#include <bits/stdc++.h>
#include <iostream>
#include <csignal>
#include <stacktrace>
#include <source_location>
using std::cin; using std::cout; using std::cerr; using std::clog; using std::endl; using std::string; // using namespace std;
using namespace std::string_literals;
/* few items for debugging purposes */
/// define if asserts are NOT to be checked. Put in *.h file not *.CPP
//#define NDEBUG
/// define GR is Debugging. Put in *.h file not *.CPP
//#define GR_DEBUG
//#ifdef GR_DEBUG
//#endif # GR_DEBUG
/// gives a source location for printing. Used for debugging.
std::string
source_loc() {
using loc = std::source_location;
//using ts = std::to_string; // todo??: why not? alternative approach?
std::string result {"\n"s + loc::current().file_name() + ":"s + std::to_string(loc::current().line()) + std::to_string(loc::current().column())+"]`"s + loc::current().function_name() + "`."s};
return result;
}