]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/ratio/example/type_traits/add_rvalue_reference.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / ratio / example / type_traits / add_rvalue_reference.hpp
CommitLineData
7c673cae
FG
1// add_rvalue_reference.hpp ---------------------------------------------------------//
2
3// Copyright 2010 Vicente J. Botet Escriba
4
5// Distributed under the Boost Software License, Version 1.0.
6// See http://www.boost.org/LICENSE_1_0.txt
7
8#ifndef BOOST_EX_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
9#define BOOST_EX_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
10
11#include <boost/config.hpp>
12
13//----------------------------------------------------------------------------//
14
15#include <boost/type_traits/is_void.hpp>
16#include <boost/type_traits/is_reference.hpp>
17
18// should be the last #include
19#include <boost/type_traits/detail/type_trait_def.hpp>
20
21//----------------------------------------------------------------------------//
22// //
23// C++03 implementation of //
24// 20.7.6.2 Reference modifications [meta.trans.ref] //
25// Written by Vicente J. Botet Escriba //
26// //
27// If T names an object or function type then the member typedef type
28// shall name T&&; otherwise, type shall name T. [ Note: This rule reflects
29// the semantics of reference collapsing. For example, when a type T names
30// a type T1&, the type add_rvalue_reference<T>::type is not an rvalue
31// reference. -end note ]
32//----------------------------------------------------------------------------//
33
34namespace boost_ex {
35
36namespace type_traits_detail {
37
38 template <typename T, bool b>
39 struct add_rvalue_reference_helper
40 { typedef T type; };
41
42 template <typename T>
43 struct add_rvalue_reference_helper<T, true>
44 {
45#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
46 typedef T&& type;
47#else
48 typedef T type;
49#endif
50 };
51
52 template <typename T>
53 struct add_rvalue_reference_imp
54 {
55 typedef typename boost_ex::type_traits_detail::add_rvalue_reference_helper
56 <T, (!boost::is_void<T>::value && !boost::is_reference<T>::value) >::type type;
57 };
58
59}
60
61BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost_ex::type_traits_detail::add_rvalue_reference_imp<T>::type)
62
63} // namespace boost_ex
64
65#include <boost/type_traits/detail/type_trait_undef.hpp>
66
67#endif // BOOST_EX_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP