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
16
17#if defined(MSGPACK_USE_CPP03)
18
19namespace msgpack {
20
24
25template <typename T>
26struct 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
33template <typename T>
34T& move(T& t)
35{
36 return t;
37}
38
39template <typename T>
40T const& move(T const& t)
41{
42 return t;
43}
44
45template <bool P, typename T>
46struct enable_if {
47 typedef T type;
48};
49
50template <typename T>
51struct enable_if<false, T> {
52};
53
54template<typename T, T val>
55struct integral_constant {
56 static T const value = val;
57 typedef T value_type;
58 typedef integral_constant<T, val> type;
59};
60
61typedef integral_constant<bool, true> true_type;
62typedef integral_constant<bool, false> false_type;
63
64template<class T, class U>
65struct is_same : false_type {};
66
67template<class T>
68struct is_same<T, T> : true_type {};
69
70template<typename T>
71struct underlying_type {
72 typedef int type;
73};
74
75template<class T>
76struct is_array : false_type {};
77
78template<class T>
79struct is_array<T[]> : true_type {};
80
81template<class T, std::size_t N>
82struct is_array<T[N]> : true_type {};
83
84
85template<class T>
86struct remove_const {
87 typedef T type;
88};
89template<class T>
90struct remove_const<const T> {
91 typedef T type;
92};
93
94template<class T>
95struct remove_volatile {
96 typedef T type;
97};
98template<class T>
99struct remove_volatile<volatile T> {
100 typedef T type;
101};
102
103template<class T>
104struct remove_cv {
105 typedef typename msgpack::remove_volatile<
106 typename msgpack::remove_const<T>::type
107 >::type type;
108};
109
110namespace detail {
111
112template<class T>
113struct is_pointer_helper : false_type {};
114
115template<class T>
116struct is_pointer_helper<T*> : true_type {};
117
118} // namespace detail
119
120template<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