blob: 1a09de7b1a89647f4d8516c0854f1e298a1ad3dc [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001// 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_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
9#define BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
10
Jeff Thompson2277ce52013-08-01 17:34:11 -070011#include <ndnboost/config.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070012
13//----------------------------------------------------------------------------//
14
Jeff Thompson2277ce52013-08-01 17:34:11 -070015#include <ndnboost/type_traits/is_void.hpp>
16#include <ndnboost/type_traits/is_reference.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070017
18// should be the last #include
Jeff Thompson2277ce52013-08-01 17:34:11 -070019#include <ndnboost/type_traits/detail/type_trait_def.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070020
21//----------------------------------------------------------------------------//
22// //
23// C++03 implementation of //
24// 20.9.7.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 ndnboost {
35
36namespace type_traits_detail {
37
38 template <typename T, bool b>
39 struct add_rvalue_reference_helper
40 { typedef T type; };
41
42#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
43 template <typename T>
44 struct add_rvalue_reference_helper<T, true>
45 {
46 typedef T&& type;
47 };
48#endif
49
50 template <typename T>
51 struct add_rvalue_reference_imp
52 {
53 typedef typename ndnboost::type_traits_detail::add_rvalue_reference_helper
54 <T, (is_void<T>::value == false && is_reference<T>::value == false) >::type type;
55 };
56
57}
58
59BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename ndnboost::type_traits_detail::add_rvalue_reference_imp<T>::type)
60
61} // namespace ndnboost
62
Jeff Thompson2277ce52013-08-01 17:34:11 -070063#include <ndnboost/type_traits/detail/type_trait_undef.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070064
65#endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
66