summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/forward_list.h4
-rw-r--r--libstdc++-v3/include/bits/move.h46
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h2
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h4
-rw-r--r--libstdc++-v3/include/bits/stl_list.h2
-rw-r--r--libstdc++-v3/include/bits/stl_map.h2
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h2
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h2
-rw-r--r--libstdc++-v3/include/bits/stl_set.h2
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h2
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h8
-rw-r--r--libstdc++-v3/include/bits/unordered_set.h8
12 files changed, 32 insertions, 52 deletions
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 3708a62c37d..4fe029d3b2d 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -452,7 +452,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param al An allocator object.
*/
forward_list(forward_list&& __list, const _Alloc& __al)
- : _Base(std::forward<_Base>(__list), __al)
+ : _Base(std::move(__list), __al)
{ }
/**
@@ -523,7 +523,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* %forward_list.
*/
forward_list(forward_list&& __list)
- : _Base(std::forward<_Base>(__list)) { }
+ : _Base(std::move(__list)) { }
/**
* @brief Builds a %forward_list from an initializer_list
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 09b9c85b07f..d5243d229be 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -50,37 +50,17 @@ _GLIBCXX_END_NAMESPACE
#include <type_traits> // Brings in std::declval too.
_GLIBCXX_BEGIN_NAMESPACE(std)
-
- /// identity
- template<typename _Tp>
- struct identity
- {
- typedef _Tp type;
- };
-
- /// forward (as per N2835)
- /// Forward lvalues as rvalues.
- template<typename _Tp>
- inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
- forward(typename std::identity<_Tp>::type& __t)
- { return static_cast<_Tp&&>(__t); }
-
- /// Forward rvalues as rvalues.
- template<typename _Tp>
- inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
- forward(typename std::identity<_Tp>::type&& __t)
- { return static_cast<_Tp&&>(__t); }
-
- // Forward lvalues as lvalues.
- template<typename _Tp>
- inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
- forward(typename std::identity<_Tp>::type __t)
- { return __t; }
-
- // Prevent forwarding rvalues as const lvalues.
- template<typename _Tp>
- inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
- forward(typename std::remove_reference<_Tp>::type&& __t) = delete;
+
+ /// forward
+ template<typename _Tp, typename _Up>
+ inline typename
+ enable_if<((std::is_convertible<
+ typename std::remove_reference<_Up>::type*,
+ typename std::remove_reference<_Tp>::type*>::value)
+ && (!std::is_lvalue_reference<_Tp>::value
+ || std::is_lvalue_reference<_Up>::value)), _Tp&&>::type
+ forward(_Up&& __u)
+ { return static_cast<_Tp&&>(__u); }
/**
* @brief Move a value.
@@ -109,10 +89,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
-#define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
+#define _GLIBCXX_MOVE(__val) std::move(__val)
#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val)
#else
-#define _GLIBCXX_MOVE(_Tp) (_Tp)
+#define _GLIBCXX_MOVE(__val) (__val)
#define _GLIBCXX_FORWARD(_Tp, __val) (__val)
#endif
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index db81761ca7d..c489b447ca1 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -528,7 +528,7 @@ template<typename _Alloc>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
vector(vector&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
vector(initializer_list<bool> __l,
const allocator_type& __a = allocator_type())
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index d3cd73997e9..397b6333b5b 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -839,8 +839,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The newly-created %deque contains the exact contents of @a x.
* The contents of @a x are a valid, but unspecified %deque.
*/
- deque(deque&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ deque(deque&& __x)
+ : _Base(std::move(__x)) { }
/**
* @brief Builds a %deque from an initializer list.
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index d6f9255752f..2bbb26fb494 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -569,7 +569,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The contents of @a x are a valid, but unspecified %list.
*/
list(list&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
/**
* @brief Builds a %list from an initializer_list
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 7f81fab1c64..5d6a98b75b2 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -179,7 +179,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The contents of @a x are a valid, but unspecified %map.
*/
map(map&& __x)
- : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+ : _M_t(std::move(__x._M_t)) { }
/**
* @brief Builds a %map from an initializer_list.
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index e5575bc9f72..82a80f27eb4 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -177,7 +177,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The contents of @a x are a valid, but unspecified %multimap.
*/
multimap(multimap&& __x)
- : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+ : _M_t(std::move(__x._M_t)) { }
/**
* @brief Builds a %multimap from an initializer_list.
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 209e58eb9e8..cfe849bf79a 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The contents of @a x are a valid, but unspecified %multiset.
*/
multiset(multiset&& __x)
- : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+ : _M_t(std::move(__x._M_t)) { }
/**
* @brief Builds a %multiset from an initializer_list.
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index 54321e278ac..ce5bc6c15f2 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -197,7 +197,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The contents of @a x are a valid, but unspecified %set.
*/
set(set&& __x)
- : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+ : _M_t(std::move(__x._M_t)) { }
/**
* @brief Builds a %set from an initializer_list.
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index d51578c9e05..147e3f7715b 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -290,7 +290,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* The contents of @a x are a valid, but unspecified %vector.
*/
vector(vector&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
/**
* @brief Builds a %vector from an initializer list.
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 80b970c8cf5..f3a16e0dd01 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__unordered_map(const __unordered_map& __x) = default;
__unordered_map(__unordered_map&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
};
template<class _Key, class _Tp,
@@ -142,7 +142,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__unordered_multimap(const __unordered_multimap& __x) = default;
__unordered_multimap(__unordered_multimap&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
};
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
@@ -253,7 +253,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
unordered_map(const unordered_map& __x) = default;
unordered_map(unordered_map&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
unordered_map(initializer_list<value_type> __l,
size_type __n = 10,
@@ -340,7 +340,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
unordered_multimap(const unordered_multimap& __x) = default;
unordered_multimap(unordered_multimap&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
unordered_multimap(initializer_list<value_type> __l,
size_type __n = 10,
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
index 8682f2d7237..f056be57ec0 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__unordered_set(const __unordered_set& __x) = default;
__unordered_set(__unordered_set&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
};
template<class _Value,
@@ -140,7 +140,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
__unordered_multiset(const __unordered_multiset& __x) = default;
__unordered_multiset(__unordered_multiset&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
};
template<class _Value, class _Hash, class _Pred, class _Alloc,
@@ -246,7 +246,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
unordered_set(const unordered_set& __x) = default;
unordered_set(unordered_set&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
unordered_set(initializer_list<value_type> __l,
size_type __n = 10,
@@ -330,7 +330,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
unordered_multiset(const unordered_multiset& __x) = default;
unordered_multiset(unordered_multiset&& __x)
- : _Base(std::forward<_Base>(__x)) { }
+ : _Base(std::move(__x)) { }
unordered_multiset(initializer_list<value_type> __l,
size_type __n = 10,