NANA
nadef.hpp
浏览该文件的文档.
1#pragma once
16#include <vector>
17#include <string>
18#include <map>
19#include <memory>
20#include <float.h>
21
22namespace NANA {
23
24#if defined _MSC_VER || defined __BORLANDC__
25typedef __int64 int64;
26typedef unsigned __int64 uint64;
27#else
28typedef int64_t int64;
29typedef uint64_t uint64;
30
31#endif
32
33#pragma region 定义数学上的常量和浮点数
35#define NA_PI 3.1415926535897932384626433832795
37#define NA_2PI 6.283185307179586476925286766559
38
40#define NA_EPS DBL_EPSILON
41
43#define NA_EulerNum 2.7182818284590452353602874713526
44
45typedef double NAFLOAT;
46
47#pragma endregion
48
49#pragma region 类型重定义
50
51typedef std::string String;
52
53
54
55#pragma endregion
56
60template<typename _Tp>
61struct Size_ {
62 Size_() :
63 width(0),
64 height(0)
65 {
66
67 }
68
69 Size_(_Tp _width, _Tp _height) {
70 width = _width;
71 height = _height;
72 }
73
74 _Tp width;
75 _Tp height;
76};
77typedef Size_<int> Size2i;
78typedef Size_<int64> Size2l;
79typedef Size_<float> Size2f;
80typedef Size_<double> Size2d;
81typedef Size2i Size;
82
88template<typename _Tp>
89inline bool isNan(_Tp x) {
90 if (x != x)
91 return true;
92 return false;
93}
94
95
96
97
98
99}
bool isNan(_Tp x)
判断一个数是否是Not a number
Definition: nadef.hpp:89
二维数组的尺寸
Definition: nadef.hpp:61
_Tp height
高度
Definition: nadef.hpp:75
_Tp width
宽度
Definition: nadef.hpp:74