/
util.hpp
37 lines (28 loc) · 908 Bytes
/
util.hpp
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
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "Exception.hpp"
#include <cstdio>
#include <cxxabi.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <typeinfo> // operator typeid
#include <vector>
namespace yacx {
void debug(const std::string &message);
std::string load(const std::string &path);
template <typename T> std::string type_of(const T &variable);
template <typename T>
struct is_string
: public std::disjunction<
std::is_arithmetic<typename std::decay<T>::type>,
std::is_same<char *, typename std::decay<T>::type>,
std::is_same<const char *, typename std::decay<T>::type>,
std::is_same<std::string, typename std::decay<T>::type>> {};
template <typename T> std::string type_of(const T &) {
std::string type_name;
NVRTC_SAFE_CALL(nvrtcGetTypeName<T>(&type_name));
return type_name;
}
} // namespace yacx