Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_forward.h
Go to the documentation of this file.
1// -*- C++ -*-
2
34#ifndef _RWSTD_RW_FORWARD_INCLUDED
35# define _RWSTD_RW_FORWARD_INCLUDED
36
37# include <rw/_defs.h>
38# include <rw/_meta_ref.h> // for __rw_remove_reference
39
40
42
43
44// 20.2.2, forward/move helpers:
45
46template <class _TypeT>
47struct identity
48{
49 typedef _TypeT type;
50
51 const type& operator() (const type& __x) const {
52 return __x;
53 }
54};
55
56# define _RWSTD_IDENTITY(_TypeT) _STD::identity<_TypeT>::type
57
58
59# if !defined _RWSTD_NO_RVALUE_REFERENCES
60
61template <class _TypeT>
62inline _TypeT&&
63forward (typename identity<_TypeT>::type&& __x)
64{
65 return static_cast<_TypeT&&>(__x);
66}
67
68template <class _TypeT>
69inline typename _RWSTD_REMOVE_REFERENCE(_TypeT)&&
70move (_TypeT&& __x)
71{
72 return static_cast<typename __rw::__rw_remove_reference<_TypeT>::type&&>(__x);
73}
74
75# define _RWSTD_FORWARD(_TypeT, __x) _STD::forward<_TypeT> (__x)
76# define _RWSTD_MOVE(__x) _STD::move (__x)
77
78# else // no rvalue references
79
80# define _RWSTD_FORWARD(_TypeT, __x) (__x)
81# define _RWSTD_MOVE(__x) (__x)
82
83# endif // !defined _RWSTD_NO_RVALUE_REFERENCES
84
85
86} // namespace std
87
88
89#endif // _RWSTD_RW_FORWARD_INCLUDED
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _RWSTD_REMOVE_REFERENCE(T)
Definition json.h:5363