+2011-06-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/allocator.h (__shrink_to_fit): Simplify.
+ * include/bits/stl_vector.h (vector<>::shrink_to_fit): Adjust.
+ * include/bits/stl_deque.h: Likewise.
+ * include/bits/stl_bvector.h: Likewise.
+
2011-06-07 Jason Merrill <jason@redhat.com>
* testsuite/lib/prune.exp: s/required/instantiated/.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
* testsuite/20_util/forward/1_neg.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
- * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Likewise.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc: Likewise.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Likewise.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Likewise.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Likewise.
- * testsuite/tr1/2_general_utilities/shared_ptr/assign/shared_ptr_neg.cc: Likewise.
+ * testsuite/tr1/2_general_utilities/shared_ptr/assign/
+ shared_ptr_neg.cc: Likewise.
2011-06-07 Paolo Carlini <paolo.carlini@oracle.com>
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- // A very basic implementation for now. In general we have to wait for
- // the availability of the infrastructure described in N2983: we should
- // try when either T has a move constructor which cannot throw or T is
- // CopyConstructible.
- // NB: This code doesn't properly belong here, we should find a more
- // suited place common to std::vector and std::deque.
- template<typename _Tp,
- bool = __has_trivial_copy(typename _Tp::value_type)>
- struct __shrink_to_fit
- { static void _S_do_it(_Tp&) { } };
-
template<typename _Tp>
- struct __shrink_to_fit<_Tp, true>
+ bool
+ __shrink_to_fit(_Tp& __v)
{
- static void
- _S_do_it(_Tp& __v)
- {
- __try
- { _Tp(__v).swap(__v); }
- __catch(...) { }
- }
- };
+ __try
+ {
+ _Tp(__v).swap(__v);
+ return true;
+ }
+ __catch(...)
+ { return false; }
+ }
template<typename _Alloc, typename _Tp>
class __alloctr_rebind_helper