/
stdheaders.hpp
78 lines (65 loc) · 1.69 KB
/
stdheaders.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* stdheaders.hpp -- exported function header
*
* Ryan McDougall
*/
#ifndef STD_HEADERS_H_
#define STD_HEADERS_H_
#include <cassert>
#include <cmath>
#include <ctime>
#include <ios>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <list>
#include <vector>
#include <memory>
#include <algorithm>
#include <iterator>
#include <tr1/cstdint>
#include <tr1/memory>
#include <tr1/functional>
#include <tr1/type_traits>
#include <QString>
#include <QMutex>
using std::isnan;
using std::isfinite;
using std::string;
using std::stringstream;
using std::for_each;
using std::pair;
using std::make_pair;
using std::auto_ptr;
using std::tr1::shared_ptr;
using std::tr1::function;
using std::tr1::bind;
using std::tr1::mem_fn;
using std::cout;
using std::cerr;
using std::endl;
using namespace std::tr1::placeholders;
typedef uint32_t msg_id_t;
typedef int frame_delta_t;
typedef QMutex Mutex;
template <typename T, bool fundamental> struct rvalue_helper {};
template <typename T> struct rvalue_helper <T, true> { typedef T type; };
template <typename T> struct rvalue_helper <T, false> { typedef T const& type; };
template <typename T> struct rvalue_helper <T*, false> { typedef T const* type; };
template <typename T>
struct rvalue
{
typedef typename rvalue_helper <T,std::tr1::is_fundamental<T>::value>::type type;
};
template <typename T> void safe_delete (T* &ptr) { delete ptr; ptr = 0; }
template <typename T> void safe_array_delete (T* &ptr) { delete [] ptr; ptr = 0; }
struct Locker
{
Mutex &mutex;
Locker (Mutex &m) : mutex (m) { mutex.lock(); }
~Locker () { mutex.unlock(); }
};
#endif //STD_HEADERS_H_