-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplatform.h
43 lines (37 loc) · 897 Bytes
/
platform.h
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
38
39
40
41
42
43
/**
* @file platform.h
* @author tonghao.yuan ([email protected])
* @brief common tools and some cross platfrom/compiler things.
* @version 0.1
* @date 2020-02-23
*
* @copyright Copyright (c) 2020
*
*/
#include "array"
#if (_MSC_VER >= 1920)
# include <filesystem>
namespace fs = std::filesystem;
#else
# include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif
/**
* @brief define boolean value for vtk
see vtkABI.h for detail
*
*/
#define VTK_TRUE 1
#define VTK_FALSE 0
using pointType = std::array<double, 3>;
auto operator<<(std::ostream& os, const pointType& p) -> std::ostream& {
os << "[" << p[0];
for (std::size_t i = 1; i < p.size(); ++i) {
os << "," << p[i];
}
os << "]";
return os;
}
constexpr auto str2int(const char* str, int h = 0) -> unsigned int {
return !str[h] ? 5381 : (str2int(str, h + 1) * 33) ^ str[h];
}