MessagePack for C++
Loading...
Searching...
No Matches
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
15#if defined(MSGPACK_USE_CPP03)
16
17namespace msgpack {
18
22
23template <typename T>
24struct unique_ptr : std::auto_ptr<T> {
25 explicit unique_ptr(T* p = 0) throw() : std::auto_ptr<T>(p) {}
26 unique_ptr(unique_ptr& a) throw() : std::auto_ptr<T>(a) {}
27 template<class Y>
28 unique_ptr (unique_ptr<Y>& a) throw() : std::auto_ptr<T>(a) {}
29};
30
31template <typename T>
32T& move(T& t)
33{
34 return t;
35}
36
37template <typename T>
38T const& move(T const& t)
39{
40 return t;
41}
42
43template <bool P, typename T>
44struct enable_if {
45 typedef T type;
46};
47
48template <typename T>
49struct enable_if<false, T> {
50};
51
52template<typename T, T val>
53struct integral_constant {
54 static T const value = val;
55 typedef T value_type;
56 typedef integral_constant<T, val> type;
57};
58
59typedef integral_constant<bool, true> true_type;
60typedef integral_constant<bool, false> false_type;
61
62template<class T, class U>
63struct is_same : false_type {};
64
65template<class T>
66struct is_same<T, T> : true_type {};
67
68template<typename T>
69struct underlying_type {
70 typedef int type;
71};
72
73template<class T>
74struct is_array : false_type {};
75
76template<class T>
77struct is_array<T[]> : true_type {};
78
79template<class T, std::size_t N>
80struct is_array<T[N]> : true_type {};
81
82
83template<class T>
84struct remove_const {
85 typedef T type;
86};
87template<class T>
88struct remove_const<const T> {
89 typedef T type;
90};
91
92template<class T>
93struct remove_volatile {
94 typedef T type;
95};
96template<class T>
97struct remove_volatile<volatile T> {
98 typedef T type;
99};
100
101template<class T>
102struct remove_cv {
103 typedef typename msgpack::remove_volatile<
105 >::type type;
106};
107
108namespace detail {
109
110template<class T>
111struct is_pointer_helper : false_type {};
112
113template<class T>
114struct is_pointer_helper<T*> : true_type {};
115
116} // namespace detail
117
118template<class T> struct is_pointer : detail::is_pointer_helper<typename remove_cv<T>::type> {};
119
120
122} // MSGPACK_API_VERSION_NAMESPACE(v1)
124
125} // namespace msgpack
126
127#endif // MSGPACK_USE_CPP03
128
129#if __cplusplus >= 201402L
130#if defined(_MSC_VER)
131#define MSGPACK_DEPRECATED(msg) __declspec(deprecated(msg))
132#else // _MSC_VER 1914+ with /Zc:__cplusplus, @see https://docs.microsoft.com/cpp/build/reference/zc-cplusplus
133#define MSGPACK_DEPRECATED(msg) [[deprecated(msg)]]
134#endif
135#else // __cplusplus >= 201402L
136#define MSGPACK_DEPRECATED(msg)
137#endif // __cplusplus >= 201402L
138
139#endif // MSGPACK_V1_CPP_CONFIG_HPP
Definition adaptor_base.hpp:15
T & move(T &t)
integral_constant< bool, true > true_type
Definition cpp_config_decl.hpp:61
integral_constant< bool, false > false_type
Definition cpp_config_decl.hpp:62
Definition cpp_config_decl.hpp:74
Definition cpp_config_decl.hpp:76
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition versioning.hpp:58