MessagePack for C++
cpp_config.hpp
Go to the documentation of this file.
1 //
2 // MessagePack for C++ C++03/C++11 Adaptation
3 //
4 // Copyright (C) 2013-2016 KONDO Takatoshi
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 //
10 #ifndef MSGPACK_V1_CPP_CONFIG_HPP
11 #define MSGPACK_V1_CPP_CONFIG_HPP
12 
14 #include "msgpack/cpp_version.hpp"
15 #include "msgpack/versioning.hpp"
16 
17 #if defined(MSGPACK_USE_CPP03)
18 
19 namespace msgpack {
20 
24 
25 template <typename T>
26 struct unique_ptr : std::auto_ptr<T> {
27  explicit unique_ptr(T* p = 0) throw() : std::auto_ptr<T>(p) {}
28  unique_ptr(unique_ptr& a) throw() : std::auto_ptr<T>(a) {}
29  template<class Y>
30  unique_ptr (unique_ptr<Y>& a) throw() : std::auto_ptr<T>(a) {}
31 };
32 
33 template <typename T>
34 T& move(T& t)
35 {
36  return t;
37 }
38 
39 template <typename T>
40 T const& move(T const& t)
41 {
42  return t;
43 }
44 
45 template <bool P, typename T>
46 struct enable_if {
47  typedef T type;
48 };
49 
50 template <typename T>
51 struct enable_if<false, T> {
52 };
53 
54 template<typename T, T val>
55 struct integral_constant {
56  static T const value = val;
57  typedef T value_type;
58  typedef integral_constant<T, val> type;
59 };
60 
61 typedef integral_constant<bool, true> true_type;
62 typedef integral_constant<bool, false> false_type;
63 
64 template<class T, class U>
65 struct is_same : false_type {};
66 
67 template<class T>
68 struct is_same<T, T> : true_type {};
69 
70 template<typename T>
71 struct underlying_type {
72  typedef int type;
73 };
74 
75 template<class T>
76 struct is_array : false_type {};
77 
78 template<class T>
79 struct is_array<T[]> : true_type {};
80 
81 template<class T, std::size_t N>
82 struct is_array<T[N]> : true_type {};
83 
84 
85 template<class T>
86 struct remove_const {
87  typedef T type;
88 };
89 template<class T>
90 struct remove_const<const T> {
91  typedef T type;
92 };
93 
94 template<class T>
95 struct remove_volatile {
96  typedef T type;
97 };
98 template<class T>
99 struct remove_volatile<volatile T> {
100  typedef T type;
101 };
102 
103 template<class T>
104 struct remove_cv {
105  typedef typename msgpack::remove_volatile<
106  typename msgpack::remove_const<T>::type
107  >::type type;
108 };
109 
110 namespace detail {
111 
112 template<class T>
113 struct is_pointer_helper : false_type {};
114 
115 template<class T>
116 struct is_pointer_helper<T*> : true_type {};
117 
118 } // namespace detail
119 
120 template<class T> struct is_pointer : detail::is_pointer_helper<typename remove_cv<T>::type> {};
121 
122 
124 } // MSGPACK_API_VERSION_NAMESPACE(v1)
126 
127 } // namespace msgpack
128 
129 #endif // MSGPACK_USE_CPP03
130 
131 #if MSGPACK_CPP_VERSION >= 201402L
132 #if defined(_MSC_VER)
133 #define MSGPACK_DEPRECATED(msg) __declspec(deprecated(msg))
134 #else
135 #define MSGPACK_DEPRECATED(msg) [[deprecated(msg)]]
136 #endif
137 #else // MSGPACK_CPP_VERSION >= 201402L
138 #define MSGPACK_DEPRECATED(msg)
139 #endif // MSGPACK_CPP_VERSION >= 201402L
140 
141 #endif // MSGPACK_V1_CPP_CONFIG_HPP
Definition: adaptor_base.hpp:15
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition: versioning.hpp:66