summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r--libstdc++-v3/include/std/bitset4
-rw-r--r--libstdc++-v3/include/std/functional69
-rw-r--r--libstdc++-v3/include/std/iomanip68
-rw-r--r--libstdc++-v3/include/std/system_error2
-rw-r--r--libstdc++-v3/include/std/thread2
-rw-r--r--libstdc++-v3/include/std/tuple50
-rw-r--r--libstdc++-v3/include/std/type_traits22
-rw-r--r--libstdc++-v3/include/std/typeindex4
8 files changed, 135 insertions, 86 deletions
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 813ed4b2599..e07c5e08970 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -1555,7 +1555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __hash_base<size_t, _GLIBCXX_STD_C::bitset<_Nb>>
{
size_t
- operator()(const _GLIBCXX_STD_C::bitset<_Nb>& __b) const
+ operator()(const _GLIBCXX_STD_C::bitset<_Nb>& __b) const noexcept
{
const size_t __clength = (_Nb + __CHAR_BIT__ - 1) / __CHAR_BIT__;
return std::_Hash_impl::hash(__b._M_getdata(), __clength);
@@ -1567,7 +1567,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __hash_base<size_t, _GLIBCXX_STD_C::bitset<0>>
{
size_t
- operator()(const _GLIBCXX_STD_C::bitset<0>&) const
+ operator()(const _GLIBCXX_STD_C::bitset<0>&) const noexcept
{ return 0; }
};
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 4a04eca8969..465fc569b23 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -843,22 +843,24 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
: public integral_constant<int, 0>
{ };
- /// The type of placeholder objects defined by libstdc++.
+ /** @brief The type of placeholder objects defined by libstdc++.
+ * @ingroup binders
+ */
template<int _Num> struct _Placeholder { };
_GLIBCXX_END_NAMESPACE_VERSION
/** @namespace std::placeholders
- * @brief ISO C++ 0x entities sub namespace for functional.
+ * @brief ISO C++11 entities sub-namespace for functional.
* @ingroup binders
- *
- * Define a large number of placeholders. There is no way to
- * simplify this with variadic templates, because we're introducing
- * unique names for each.
*/
namespace placeholders
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ /* Define a large number of placeholders. There is no way to
+ * simplify this with variadic templates, because we're introducing
+ * unique names for each.
+ */
extern const _Placeholder<1> _1;
extern const _Placeholder<2> _2;
extern const _Placeholder<3> _3;
@@ -903,6 +905,11 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
: public integral_constant<int, _Num>
{ };
+ template<int _Num>
+ struct is_placeholder<const _Placeholder<_Num> >
+ : public integral_constant<int, _Num>
+ { };
+
/**
* Used by _Safe_tuple_element to indicate that there is no tuple
* element at this position.
@@ -1424,8 +1431,56 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* @brief Class template _Bind is always a bind expression.
* @ingroup binders
*/
+ template<typename _Signature>
+ struct is_bind_expression<const _Bind<_Signature> >
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Signature>
+ struct is_bind_expression<volatile _Bind<_Signature> >
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Signature>
+ struct is_bind_expression<const volatile _Bind<_Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<_Bind_result<_Result, _Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const _Bind_result<_Result, _Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<volatile _Bind_result<_Result, _Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
template<typename _Result, typename _Signature>
- struct is_bind_expression<_Bind_result<_Result, _Signature> >
+ struct is_bind_expression<const volatile _Bind_result<_Result, _Signature>>
: public true_type { };
// Trait type used to remove std::bind() from overload set via SFINAE
diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index ea2c44acf6f..e725b2514df 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -1,7 +1,7 @@
// Standard stream manipulators -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-// 2006, 2007, 2008, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -262,18 +262,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f)
{
- typedef istreambuf_iterator<_CharT, _Traits> _Iter;
- typedef money_get<_CharT, _Iter> _MoneyGet;
-
- ios_base::iostate __err = ios_base::goodbit;
- const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
-
- __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
- __is, __err, __f._M_mon);
-
- if (ios_base::goodbit != __err)
- __is.setstate(__err);
-
+ typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::goodbit;
+ __try
+ {
+ typedef istreambuf_iterator<_CharT, _Traits> _Iter;
+ typedef money_get<_CharT, _Iter> _MoneyGet;
+
+ const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc());
+ __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl,
+ __is, __err, __f._M_mon);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __is._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __is._M_setstate(ios_base::badbit); }
+ if (ios_base::goodbit != __err)
+ __is.setstate(__err);
+ }
return __is;
}
@@ -298,16 +309,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
- typedef money_put<_CharT, _Iter> _MoneyPut;
-
- const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
- const _Iter __end = __mp.put(_Iter(__os.rdbuf()), __f._M_intl,
- __os, __os.fill(), __f._M_mon);
-
- if (__end.failed())
- __os.setstate(ios_base::badbit);
-
+ typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os);
+ if (__cerb)
+ {
+ __try
+ {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Iter;
+ typedef money_put<_CharT, _Iter> _MoneyPut;
+ const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc());
+ const _Iter __end = __mp.put(_Iter(__os.rdbuf()), __f._M_intl,
+ __os, __os.fill(), __f._M_mon);
+ if (__end.failed())
+ __os.setstate(ios_base::badbit);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __os._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __os._M_setstate(ios_base::badbit); }
+ }
return __os;
}
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 565261e709b..19482bc2181 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -361,7 +361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __hash_base<size_t, error_code>
{
size_t
- operator()(const error_code& __e) const
+ operator()(const error_code& __e) const noexcept
{
const size_t __tmp = std::_Hash_impl::hash(__e._M_value);
return std::_Hash_impl::__hash_combine(__e._M_cat, __tmp);
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 8cc06903ebf..1d1733731bf 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -221,7 +221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __hash_base<size_t, thread::id>
{
size_t
- operator()(const thread::id& __id) const
+ operator()(const thread::id& __id) const noexcept
{ return std::_Hash_impl::hash(__id._M_thread); }
};
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 51be289d506..282d4509d3a 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -69,35 +69,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __add_r_ref<_Tp&>
{ typedef _Tp& type; };
- // To work around c++/49225 aka c++/48322.
- template<typename...>
- struct __conv_types { };
-
- template<typename _Tuple1, typename _Tuple2>
- struct __one_by_one_convertible
- : public false_type { };
-
- template<typename _Tp, typename _Up>
- struct __one_by_one_convertible<__conv_types<_Tp>, __conv_types<_Up>>
- : public is_convertible<_Tp, _Up>::type { };
-
- template<typename _T1, typename... _TR, typename _U1, typename... _UR>
- struct __one_by_one_convertible<__conv_types<_T1, _TR...>,
- __conv_types<_U1, _UR...>>
- : public __and_<is_convertible<_T1, _U1>,
- __one_by_one_convertible<__conv_types<_TR...>,
- __conv_types<_UR...>>>::type
- { };
-
- template<typename _Tuple1, typename _Tuple2>
- struct __all_convertible;
-
- template<typename... _TTypes, typename... _UTypes>
- struct __all_convertible<__conv_types<_TTypes...>,
- __conv_types<_UTypes...>>
- : public __one_by_one_convertible<__conv_types<_TTypes...>,
- __conv_types<_UTypes...>>::type { };
-
template<std::size_t _Idx, typename _Head, bool _IsEmpty>
struct _Head_base;
@@ -408,11 +379,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Inherited(__elements...) { }
template<typename... _UElements, typename = typename
- enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
- == sizeof...(_Elements)>,
- __all_convertible<__conv_types<_UElements...>,
- __conv_types<_Elements...>>
- >::value>::type>
+ enable_if<__and_<is_convertible<_UElements,
+ _Elements>...>::value>::type>
explicit
constexpr tuple(_UElements&&... __elements)
: _Inherited(std::forward<_UElements>(__elements)...) { }
@@ -422,21 +390,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr tuple(tuple&&) = default;
template<typename... _UElements, typename = typename
- enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
- == sizeof...(_Elements)>,
- __all_convertible<__conv_types<const _UElements&...>,
- __conv_types<_Elements...>>
- >::value>::type>
+ enable_if<__and_<is_convertible<const _UElements&,
+ _Elements>...>::value>::type>
constexpr tuple(const tuple<_UElements...>& __in)
: _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
template<typename... _UElements, typename = typename
- enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
- == sizeof...(_Elements)>,
- __all_convertible<__conv_types<_UElements...>,
- __conv_types<_Elements...>>
- >::value>::type>
+ enable_if<__and_<is_convertible<_UElements,
+ _Elements>...>::value>::type>
constexpr tuple(tuple<_UElements...>&& __in)
: _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index a0208590bb5..46e3f800cab 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -745,6 +745,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Implementation for non-reference types. To meet the proper
// variable definition semantics, we also need to test for
// is_destructible in this case.
+ // This form should be simplified by a single expression:
+ // ::delete ::new _Tp(declval<_Arg>()), see c++/51222.
struct __do_is_direct_constructible_impl
{
template<typename _Tp, typename _Arg, typename
@@ -778,9 +780,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct remove_reference;
template<typename _From, typename _To, bool
- = is_reference<_From>::value>
+ = __not_<__or_<is_void<_From>,
+ is_function<_From>>>::value>
struct __is_base_to_derived_ref;
+ // Detect whether we have a downcast situation during
+ // reference binding.
template<typename _From, typename _To>
struct __is_base_to_derived_ref<_From, _To, true>
{
@@ -803,6 +808,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
is_rvalue_reference<_To>>::value>
struct __is_lvalue_to_rvalue_ref;
+ // Detect whether we have an lvalue of non-function type
+ // bound to a reference-compatible rvalue-reference.
template<typename _From, typename _To>
struct __is_lvalue_to_rvalue_ref<_From, _To, true>
{
@@ -810,8 +817,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_From>::type>::type __src_t;
typedef typename remove_cv<typename remove_reference<
_To>::type>::type __dst_t;
- typedef __or_<is_same<__src_t, __dst_t>,
- is_base_of<__dst_t, __src_t>> type;
+ typedef __and_<__not_<is_function<__src_t>>,
+ __or_<is_same<__src_t, __dst_t>,
+ is_base_of<__dst_t, __src_t>>> type;
static constexpr bool value = type::value;
};
@@ -823,9 +831,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Here we handle direct-initialization to a reference type as
// equivalent to a static_cast modulo overshooting conversions.
// These are restricted to the following conversions:
- // a) A glvalue of a base class to a derived class reference
+ // a) A base class value to a derived class reference
// b) An lvalue to an rvalue-reference of reference-compatible
- // types
+ // types that are not functions
template<typename _Tp, typename _Arg>
struct __is_direct_constructible_ref_cast
: public __and_<__is_static_castable<_Arg, _Tp>,
@@ -850,7 +858,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Since default-construction and binary direct-initialization have
// been handled separately, the implementation of the remaining
- // n-ary construction cases is rather straightforward.
+ // n-ary construction cases is rather straightforward. We can use
+ // here a functional cast, because array types are excluded anyway
+ // and this form is never interpreted as a C cast.
struct __do_is_nary_constructible_impl
{
template<typename _Tp, typename... _Args, typename
diff --git a/libstdc++-v3/include/std/typeindex b/libstdc++-v3/include/std/typeindex
index a92c2969b97..fa07ac620e6 100644
--- a/libstdc++-v3/include/std/typeindex
+++ b/libstdc++-v3/include/std/typeindex
@@ -76,7 +76,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return !_M_target->before(*__rhs._M_target); }
size_t
- hash_code() const
+ hash_code() const noexcept
{ return _M_target->hash_code(); }
const char*
@@ -97,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef type_index argument_type;
size_t
- operator()(const type_index& __ti) const
+ operator()(const type_index& __ti) const noexcept
{ return __ti.hash_code(); }
};