-
Notifications
You must be signed in to change notification settings - Fork 104
/
utility.h
executable file
·64 lines (58 loc) · 1.49 KB
/
utility.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* @file utility.h
* @brief 导入公共高级库
* Licensed under the MIT licenses.
*
* @version 1.0
* @author OWenT, [email protected]
* @date 2012.08.02
*
* @history
*
*/
#ifndef STD_UTILITY_H
#define STD_UTILITY_H
#pragma once
// ============================================================
// 公共包含部分
// 自动导入TR1库
// ============================================================
/**
* 导入utility文件(utility)
* 如果是G++且支持c++0x草案1(tr1版本)的utility[GCC版本高于4.0]
* 则会启用GNU-C++的utility
*
* 如果是VC++且支持c++0x草案1(tr1版本)的utility[VC++版本高于9.0 SP1]
* 则会启用VC++的utility
*
* 否则启用boost中的utility库(如果是这种情况需要加入boost库)
*/
// VC9.0 SP1以上分支判断
#if defined(_MSC_VER) && ((_MSC_VER == 1500 && defined(_HAS_TR1)) || _MSC_VER > 1500)
// 采用VC std::tr1库
# include <utility>
#elif defined(__clang__) && __clang_major__ >= 3
// 采用Clang c++11库
# include <utility>
#elif defined(__GNUC__) && __GNUC__ >= 4
// 采用G++ std::tr1库
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
# include <utility>
# else
# include <tr1/utility>
namespace std {
using tr1::get;
using tr1::tuple_element;
using tr1::tuple_size;
} // namespace std
# endif
#else
// 采用boost库
# include <boost/tr1/utility.hpp>
namespace std {
using tr1::get;
using tr1::tuple_element;
using tr1::tuple_size;
} // namespace std
#endif
#endif