allocator.h (__shrink_to_fit): Simplify.
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. From-SVN: r174802
This commit is contained in:
parent
6c8e9fc9e8
commit
76aa78e9eb
5 changed files with 24 additions and 25 deletions
|
@ -1,3 +1,10 @@
|
|||
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/.
|
||||
|
@ -7,7 +14,8 @@
|
|||
* 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.
|
||||
|
@ -17,7 +25,8 @@
|
|||
* 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>
|
||||
|
||||
|
|
|
@ -184,28 +184,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
};
|
||||
|
||||
#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
|
||||
|
|
|
@ -844,7 +844,7 @@ template<typename _Alloc>
|
|||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
void
|
||||
shrink_to_fit()
|
||||
{ std::__shrink_to_fit<vector>::_S_do_it(*this); }
|
||||
{ std::__shrink_to_fit(*this); }
|
||||
#endif
|
||||
|
||||
void
|
||||
|
|
|
@ -1196,7 +1196,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
/** A non-binding request to reduce memory use. */
|
||||
void
|
||||
shrink_to_fit()
|
||||
{ std::__shrink_to_fit<deque>::_S_do_it(*this); }
|
||||
{ std::__shrink_to_fit(*this); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -646,7 +646,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
/** A non-binding request to reduce capacity() to size(). */
|
||||
void
|
||||
shrink_to_fit()
|
||||
{ std::__shrink_to_fit<vector>::_S_do_it(*this); }
|
||||
{ std::__shrink_to_fit(*this); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue