2005-05-27 23:01:45 +08:00
|
|
|
// Debugging support implementation -*- C++ -*-
|
|
|
|
|
2018-01-03 18:03:58 +08:00
|
|
|
// Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
2005-05-27 23:01:45 +08:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 23:00:19 +08:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2005-05-27 23:01:45 +08:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 23:00:19 +08:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2005-05-27 23:01:45 +08:00
|
|
|
|
2006-11-30 04:59:22 +08:00
|
|
|
/** @file debug/functions.h
|
|
|
|
* This file is a GNU debug extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
2005-05-27 23:01:45 +08:00
|
|
|
#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H
|
|
|
|
#define _GLIBCXX_DEBUG_FUNCTIONS_H 1
|
|
|
|
|
2016-05-13 22:47:46 +08:00
|
|
|
#include <bits/move.h> // for __addressof
|
|
|
|
#include <bits/stl_function.h> // for less
|
2013-08-02 03:54:46 +08:00
|
|
|
#if __cplusplus >= 201103L
|
2016-05-13 22:47:46 +08:00
|
|
|
# include <type_traits> // for is_lvalue_reference and conditional.
|
2013-08-02 03:54:46 +08:00
|
|
|
#endif
|
2015-05-29 François Dumont fdumont@gcc.gnu.org>
* include/debug/debug.h (_GLIBCXX_DEBUG_ASSERT,
_GLIBCXX_DEBUG_PEDASSERT, _GLIBCXX_DEBUG_ONLY): Move definition...
* include/debug/assertions.h: ...here, new.
* include/debug/formatter.h
(_Error_formatter::_Is_iterator_value_type): New.
(_Error_formatter::_Is_instance): New.
(_Error_formatter::_Parameter): Make public and not friend anymore.
(_Error_formatter::_Parameter::__instance): New _M_kind enum entry.
(_Error_formatter::_Parameter::__iterator_value_type): New _M_kind enum
entry.
(_Error_formatter::_Parameter::_Type): New.
(_Error_formatter::_Parameter::_Instance): New, inherit from
latter.
(union _Error_formatter::_Parameter::_M_variant): Reorganize.
(_Parameter(_Iterator const&, const char*, _Is_iterator)): Make all
overloads take iterator through a const reference.
(_Parameter(const _Iterator&, const char*, _Is_iterator_value_type)):
New.
(_Parameter(const _Type&, const char*, _Is_instance)): New.
(_Error_formatter::_M_print_type): Delete.
(_Error_formatter::_M_iterator_value_type): New.
(_Error_formatter::_M_instance): New.
* include/Makefile.am: Add new above debug file.
* include/Makefile.in: Regenerate.
* include/debug/functions.h
(__check_dereferenceable(const _Safe_iterator<>&),
__valid_range(const _Safe_iterator<>&),
__is_safe_random_iterator<_Safe_iterator<>>): Move...
* include/debug/safe_iterator.h: ... here.
Replace debug.h include with assertions.h.
(__check_singular_aux): Move...
* include/debug/safe_base.h: ... here.
* include/debug/functions.h
(__check_dereferenceable(const _Safe_local_iterator<>&),
__valid_range(const _Safe_local_iterator<>&): Move...
* include/debug/safe_local_iterator.h: ...here.
* include/debug/safe_sequence.h: Replace debug.h with assertions.h.
Remove _Safe_iterator declaration.
* include/debug/safe_unordered_container.h: Replace debug.h with
assertions.h.
* include/debug/array: Replace safe_sequence.h include with
formatter.h and macros.h.
* include/debug/deque: Include functions.tcc.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/string: Likewise.
* include/debug/vector: Likewise.
* include/bits/unique_ptr.h: Replace debug.h include with new
assertions.h.
* include/bits/stl_iterator_base_funcs.h: Likewise.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Likewise.
* src/c++11/debug.cc: Adapt.
From-SVN: r223877
2015-05-30 05:29:07 +08:00
|
|
|
|
stl_iterator_base_types.h (_Iter_base): Limit definition to pre-C++11 mode.
2015-06-29 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_iterator_base_types.h (_Iter_base): Limit definition
to pre-C++11 mode.
* include/debug/functions.h
(__gnu_debug::__valid_range, __gnu_debug::__base): Move...
* include/debug/safe_iterator.h
(__gnu_debug::_Sequence_traits): New.
(__gnu_debug::__get_distance_from_begin): New.
(__gnu_debug::__get_distance_to_end): New.
(__gnu_debug::_Safe_iterator<>::_M_valid_range): Expose iterator range
distance information. Add optional check_dereferenceable parameter,
default true.
(__gnu_debug::_Distance_precision, __gnu_debug::__get_distance): Move
default definition...
(__gnu_debug::__get_distance): New overload for _Safe_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/helper_functions.h: ...here. New.
(__gnu_debug::__unsafe): New helper function to remove safe iterator
layer.
* include/debug/stl_iterator.h: New. Include latter.
* include/bits/stl_iterator.h: Include latter in debug mode.
* include/debug/stl_iterator.tcc: Adapt.
* include/debug/safe_local_iterator.h (__gnu_debug::__get_distance): Add
overload for _Safe_local_iterator.
(__gnu_debug::__unsafe): Likewise.
* include/debug/safe_local_iterator.tcc: Adapt.
* include/debug/macros.h (__glibcxx_check_valid_range2): New.
(__glibcxx_check_insert_range): Add _Dist parameter.
(__glibcxx_check_insert_range_after): Likewise.
(__glibcxx_check_string, __glibcxx_check_string_len): Implement using
_GLIBCXX_DEBUG_PEDASSERT.
* include/debug/deque (deque<>::assign): Remove iterator debug layer
when possible.
(deque<>::insert): Likewise.
* include/debug/forward_list (__glibcxx_check_valid_fl_range): New.
(forward_list<>::splice_after): Use latter.
(forward_list<>::assign): Remove iterator debug layer when possible.
(forward_list<>::insert_after): Likewise.
(__gnu_debug::_Sequence_traits<>): Partial specialization.
* include/debug/list (list<>::assign): Remove iterator debug layer when
possible.
(list<>::insert): Likewise.
[__gnu_debug::_Sequence_traits<>]: Partial specialization pre C++11 ABI.
* include/debug/map.h (map<>::insert): Remove iterator debug layer when
possible.
* include/debug/multimap.h (multimap<>::insert): Likewise.
* include/debug/set.h (set<>::insert): Likewise.
* include/debug/multiset.h (multiset<>::insert): Likewise.
* include/debug/string (basic_string<>::append, basic_string<>::assign,
basic_string<>::insert, basic_string<>::replace): Likewise.
* include/debug/unordered_map
(unordered_map<>::insert, unordered_multimap<>::insert): Likewise.
* include/debug/unordered_set
(unordered_set<>::insert, unordered_multiset<>insert): Likewise.
* include/debug/vector
(vector<>::assign, vector<>::insert): Likewise.
* include/Makefile.am: Add new debug headers.
* include/Makefile.in: Regenerate.
From-SVN: r225143
2015-06-30 04:17:56 +08:00
|
|
|
#include <debug/helper_functions.h>
|
[multiple changes]
2010-08-29 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/23_containers/bitset/invalidation: Move...
* testsuite/23_containers/bitset/debug/invalidation: ... here.
* testsuite/23_containers/deque/invalidation: Move...
* testsuite/23_containers/deque/debug/invalidation: ... here.
* testsuite/23_containers/list/invalidation: Move...
* testsuite/23_containers/list/debug/invalidation: ... here.
* testsuite/23_containers/map/invalidation: Move...
* testsuite/23_containers/map/debug/invalidation: ... here.
* testsuite/23_containers/multimap/invalidation: Move...
* testsuite/23_containers/multimap/debug/invalidation: ... here.
* testsuite/23_containers/set/invalidation: Move...
* testsuite/23_containers/set/debug/invalidation: ... here.
* testsuite/23_containers/multiset/invalidation: Move...
* testsuite/23_containers/multiset/debug/invalidation: ... here.
* testsuite/23_containers/vector/invalidation: Move...
* testsuite/23_containers/vector/debug/invalidation: ... here.
2010-08-29 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (_Iter_base): Move...
* include/bits/stl_iterator_base_types.h: ...here.
* include/debug/functions.h (__check_valid_range, __check_string,
__check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include
formatter.h and use formatting macros for a consistent debug result.
* include/debug/formatter.h (__check_singular): Declare; do not
include debug.h.
* include/debug/debug.h: Do not include formatter.h.
* include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator)
rename to iterator_type.
(__gnu_debug::__base): Add.
* include/debug/set.h: Use everywhere __gnu_debug::__base once
iterator range valided.
* include/debug/unordered_map: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/vector: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/deque: Likewise.
* include/debug/map.h: Likewise.
* include/debug/string: Likewise.
* include/debug/list: Likewise.
* include/debug/multimap.h: Likewise.
* testsuite/23_containers/util/debug/assign_neg.h: New test cases on
debug checks performed on container assign operation.
* testsuite/23_containers/util/debug/construct_neg.h: New test cases
on debug checks on constructors.
* testsuite/23_containers/util/debug/insert_neg.h: New test cases on
debug checks performed on container insert operations.
* testsuite/23_containers/unordered_map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: New.
* testsuite/23_containers/multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/vector/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/deque/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/list/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
list_construct1.cc: New, validate performance impact of the patch
on the debug mode.
* testsuite/performance/23_containers/range_construct/
list_construct2.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
vector_construct.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
deque_construct.cc: Likewise.
From-SVN: r163628
2010-08-30 01:39:00 +08:00
|
|
|
#include <debug/formatter.h>
|
2005-05-27 23:01:45 +08:00
|
|
|
|
|
|
|
namespace __gnu_debug
|
|
|
|
{
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
class _Safe_iterator;
|
|
|
|
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _Sequence>
|
|
|
|
struct _Insert_range_from_self_is_safe
|
|
|
|
{ enum { __value = 0 }; };
|
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
template<typename _Sequence>
|
|
|
|
struct _Is_contiguous_sequence : std::__false_type { };
|
|
|
|
|
2005-05-27 23:01:45 +08:00
|
|
|
// An arbitrary iterator pointer is not singular.
|
|
|
|
inline bool
|
|
|
|
__check_singular_aux(const void*) { return false; }
|
|
|
|
|
|
|
|
// We may have an iterator that derives from _Safe_iterator_base but isn't
|
|
|
|
// a _Safe_iterator.
|
|
|
|
template<typename _Iterator>
|
|
|
|
inline bool
|
2013-10-26 03:25:06 +08:00
|
|
|
__check_singular(const _Iterator& __x)
|
2015-06-17 05:04:53 +08:00
|
|
|
{ return __check_singular_aux(std::__addressof(__x)); }
|
2005-05-27 23:01:45 +08:00
|
|
|
|
|
|
|
/** Non-NULL pointers are nonsingular. */
|
|
|
|
template<typename _Tp>
|
|
|
|
inline bool
|
|
|
|
__check_singular(const _Tp* __ptr)
|
|
|
|
{ return __ptr == 0; }
|
|
|
|
|
|
|
|
/** Assume that some arbitrary iterator is dereferenceable, because we
|
|
|
|
can't prove that it isn't. */
|
|
|
|
template<typename _Iterator>
|
|
|
|
inline bool
|
2013-10-26 03:25:06 +08:00
|
|
|
__check_dereferenceable(const _Iterator&)
|
2005-05-27 23:01:45 +08:00
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
/** Non-NULL pointers are dereferenceable. */
|
|
|
|
template<typename _Tp>
|
|
|
|
inline bool
|
|
|
|
__check_dereferenceable(const _Tp* __ptr)
|
|
|
|
{ return __ptr; }
|
|
|
|
|
|
|
|
/* Checks that [first, last) is a valid range, and then returns
|
|
|
|
* __first. This routine is useful when we can't use a separate
|
|
|
|
* assertion statement because, e.g., we are in a constructor.
|
|
|
|
*/
|
|
|
|
template<typename _InputIterator>
|
|
|
|
inline _InputIterator
|
|
|
|
__check_valid_range(const _InputIterator& __first,
|
mt_allocator.h (__mt_alloc::__mt_alloc): Remove name of unused parameter.
2005-12-26 Chris Jefferson <chris@bubblescope.net>
* include/ext/mt_allocator.h (__mt_alloc::__mt_alloc): Remove
name of unused parameter.
* include/bits/stream_iterator.h (istream_iterator::istream_iterator):
Construct _M_value.
* include/debug/functions.h (__check_valid_range): Add
__attribute__((unused)).
* include/tr1/hashtable (hashtable::end): Remove name of unused
parameter.
* include/tr1/tuple_iterate.h (tuple::tuple): Likewise.
(tuple::operator=): Add __attribute__((unused)).
* include/tr1/functional (Fnv_hash<4>::hash): Add static_cast.
(Fnv_hash<8>::hash): Likewise.
* testsuite/25_algorithms/iter_swap/20577.cc (swap): Remove name of
unused parameter.
* testsuite/25_algorithms/unique_copy/check_type.cc (S2::S2,X2::X2):
Likewise.
* testsuite/22_locale/ctype/narrow/char/19955.cc (do_narrow): Likewise.
* testsuite/22_locale/ctype/is/char/9858.cc (Derived::do_is,
Derived::do_scan_is, Derived::do_scan_not, Derived2::do_is,
Derived2::do_scan_is, Derived2::do_scan_not): Likewise.
* testsuite/22_locale/time_put/put/wchar_t/12439_1.cc (TP::do_put):
Likewise.
* testsuite/22_locale/time_put/put/wchar_t/12439_3.cc (TP::do_put):
Likewise.
* testsuite/22_locale/time_put/put/char/12439_1.cc (TP::do_put):
Likewise.
* testsuite/22_locale/time_put/put/char/12439_3.cc (TP::do_put):
Likewise.
* testsuite/testsuite_io.h (fail_num_get::do_get, fail_num_put::do_put):
Likewise.
* testsuite/25_algorithms/find/17441.cc (find): Likewise.
* testsuite/23_containers/vector/cons/clear_allocator.cc
(clear_alloc::clear_alloc): Likewise.
* testsuite/23_containers/vector/bool/clear_allocator.cc
(clear_alloc::clear_alloc): Likewise.
* testsuite/23_containers/list/cons/clear_allocator.cc
(clear_alloc::clear_alloc): Likewise.
* testsuite/23_containers/set/modifiers/16728.cc (test_container):
Likewise.
* testsuite/27_io/basic_ios/cons/char/3.cc (char_traits::to_char_type,
to_int_type): Likewise.
* testsuite/27_io/basic_filebuf/imbue/12206.cc (codecvt::do_out, do_in,
do_unshift, do_length): Likewise.
* testsuite/21_strings/basic_string/capacity/1.cc
(operator==(A<T>,A<T>), operator<(A<T>,A<T>),
char_traits::to_char_type, char_traits::to_int_type): Likewise
* testsuite/testsuite_character.h (ctype::do_is, ctype::do_scan_is,
ctype::do_scan_not, do_toupper, do_tolower): Likewise.
* testsuite/25_algorithms/replace_copy/check_type.cc (Z::operator=):
Add missing return statement.
* testsuite/25_algorithms/replace_copy_if/check_type.cc (Z::operator=):
Likewise.
* testsuite/testsuite_iterators.h (output_iterator_wrapper::operator=,
random_access_iterator_wrapper::operator==): Likewise.
* testsuite/20_util/functional/binders/1.cc (s::f_int_int_const,
s::f_int_int, s::f_int_void_const, s::f_int_void): Likewise.
* testsuite/27_io/types/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/write/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/write/char/1.cc (test01): Likewise.
* testsuite/21_strings/c_strings/wchar_t/24559.cc (main): Likewise.
* testsuite/27_io/basic_istream/ignore/wchar_t/2.cc (check): Add static
cast.
* testsuite/27_io/basic_istream/ignore/char/2.cc (check): Likewise.
* testsuite/27_io/basic_istream/getline/wchar_t/5.cc (check): Likewise.
* testsuite/27_io/basic_istream/getline/char/5.cc (check): Likewise.
* testsuite/testsuite_allocator.h (check_new): Likewise.
(check_deallocate_null): Add missing return value.
* testsuite/ext/pool_allocator/allocate_chunk.cc (test01):
Make variable unsigned.
* testsuite/23_containers/vector/modifiers/erase/1.cc (N,N1,N2,N3,N4,
N5,test01): Likewise.
* testsuite/26_numerics/valarray/valarray_subset_assignment.cc
(check_array): Likewise.
(main): Removed unused variable.
* testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc (test05):
Removed unused variable.
* testsuite/27_io/basic_ostream/flush/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/flush/char/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/endl/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/endl/char/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/ends/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/ends/char/1.cc (test01): Likewise.
* testsuite/tr1/2_general_utilities/memory/shared_ptr/
assign/shared_ptr.cc (test01): Correct return type.
* testsuite/27_io/basic_filebuf/close/char/2.cc (test_02):
Add default value to close_num.
From-SVN: r109062
2005-12-26 18:53:42 +08:00
|
|
|
const _InputIterator& __last
|
|
|
|
__attribute__((__unused__)))
|
2005-05-27 23:01:45 +08:00
|
|
|
{
|
[multiple changes]
2010-08-29 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/23_containers/bitset/invalidation: Move...
* testsuite/23_containers/bitset/debug/invalidation: ... here.
* testsuite/23_containers/deque/invalidation: Move...
* testsuite/23_containers/deque/debug/invalidation: ... here.
* testsuite/23_containers/list/invalidation: Move...
* testsuite/23_containers/list/debug/invalidation: ... here.
* testsuite/23_containers/map/invalidation: Move...
* testsuite/23_containers/map/debug/invalidation: ... here.
* testsuite/23_containers/multimap/invalidation: Move...
* testsuite/23_containers/multimap/debug/invalidation: ... here.
* testsuite/23_containers/set/invalidation: Move...
* testsuite/23_containers/set/debug/invalidation: ... here.
* testsuite/23_containers/multiset/invalidation: Move...
* testsuite/23_containers/multiset/debug/invalidation: ... here.
* testsuite/23_containers/vector/invalidation: Move...
* testsuite/23_containers/vector/debug/invalidation: ... here.
2010-08-29 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (_Iter_base): Move...
* include/bits/stl_iterator_base_types.h: ...here.
* include/debug/functions.h (__check_valid_range, __check_string,
__check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include
formatter.h and use formatting macros for a consistent debug result.
* include/debug/formatter.h (__check_singular): Declare; do not
include debug.h.
* include/debug/debug.h: Do not include formatter.h.
* include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator)
rename to iterator_type.
(__gnu_debug::__base): Add.
* include/debug/set.h: Use everywhere __gnu_debug::__base once
iterator range valided.
* include/debug/unordered_map: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/vector: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/deque: Likewise.
* include/debug/map.h: Likewise.
* include/debug/string: Likewise.
* include/debug/list: Likewise.
* include/debug/multimap.h: Likewise.
* testsuite/23_containers/util/debug/assign_neg.h: New test cases on
debug checks performed on container assign operation.
* testsuite/23_containers/util/debug/construct_neg.h: New test cases
on debug checks on constructors.
* testsuite/23_containers/util/debug/insert_neg.h: New test cases on
debug checks performed on container insert operations.
* testsuite/23_containers/unordered_map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: New.
* testsuite/23_containers/multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/vector/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/deque/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/list/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
list_construct1.cc: New, validate performance impact of the patch
on the debug mode.
* testsuite/performance/23_containers/range_construct/
list_construct2.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
vector_construct.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
deque_construct.cc: Likewise.
From-SVN: r163628
2010-08-30 01:39:00 +08:00
|
|
|
__glibcxx_check_valid_range(__first, __last);
|
2005-05-27 23:01:45 +08:00
|
|
|
return __first;
|
|
|
|
}
|
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
/* Handle the case where __other is a pointer to _Sequence::value_type. */
|
2013-08-31 04:55:37 +08:00
|
|
|
template<typename _Iterator, typename _Sequence>
|
2013-08-02 03:54:46 +08:00
|
|
|
inline bool
|
|
|
|
__foreign_iterator_aux4(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
2014-03-22 02:54:06 +08:00
|
|
|
const typename _Sequence::value_type* __other)
|
2013-08-02 03:54:46 +08:00
|
|
|
{
|
2014-03-22 02:54:06 +08:00
|
|
|
typedef const typename _Sequence::value_type* _PointerType;
|
|
|
|
typedef std::less<_PointerType> _Less;
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
constexpr _Less __l{};
|
|
|
|
#else
|
|
|
|
const _Less __l = _Less();
|
|
|
|
#endif
|
|
|
|
const _Sequence* __seq = __it._M_get_sequence();
|
|
|
|
const _PointerType __begin = std::__addressof(*__seq->_M_base().begin());
|
|
|
|
const _PointerType __end = std::__addressof(*(__seq->_M_base().end()-1));
|
2013-08-02 03:54:46 +08:00
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
// Check whether __other points within the contiguous storage.
|
|
|
|
return __l(__other, __begin) || __l(__end, __other);
|
2013-08-02 03:54:46 +08:00
|
|
|
}
|
2013-08-31 04:55:37 +08:00
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
/* Fallback overload for when we can't tell, assume it is valid. */
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
2013-08-31 04:55:37 +08:00
|
|
|
inline bool
|
2014-03-22 02:54:06 +08:00
|
|
|
__foreign_iterator_aux4(const _Safe_iterator<_Iterator, _Sequence>&, ...)
|
2013-08-31 04:55:37 +08:00
|
|
|
{ return true; }
|
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
/* Handle sequences with contiguous storage */
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _Iterator, typename _Sequence, typename _InputIterator>
|
|
|
|
inline bool
|
|
|
|
__foreign_iterator_aux3(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
2014-03-22 02:54:06 +08:00
|
|
|
const _InputIterator& __other,
|
|
|
|
const _InputIterator& __other_end,
|
|
|
|
std::__true_type)
|
2013-08-02 03:54:46 +08:00
|
|
|
{
|
2014-03-22 02:54:06 +08:00
|
|
|
if (__other == __other_end)
|
|
|
|
return true; // inserting nothing is safe even if not foreign iters
|
|
|
|
if (__it._M_get_sequence()->begin() == __it._M_get_sequence()->end())
|
|
|
|
return true; // can't be self-inserting if self is empty
|
|
|
|
return __foreign_iterator_aux4(__it, std::__addressof(*__other));
|
2013-08-02 03:54:46 +08:00
|
|
|
}
|
2014-03-22 02:54:06 +08:00
|
|
|
|
|
|
|
/* Handle non-contiguous containers, assume it is valid. */
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _Iterator, typename _Sequence, typename _InputIterator>
|
|
|
|
inline bool
|
2014-03-22 02:54:06 +08:00
|
|
|
__foreign_iterator_aux3(const _Safe_iterator<_Iterator, _Sequence>&,
|
|
|
|
const _InputIterator&, const _InputIterator&,
|
|
|
|
std::__false_type)
|
2013-08-02 03:54:46 +08:00
|
|
|
{ return true; }
|
2013-08-31 04:55:37 +08:00
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
/** Handle debug iterators from the same type of container. */
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _Iterator, typename _Sequence, typename _OtherIterator>
|
|
|
|
inline bool
|
|
|
|
__foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
|
|
|
const _Safe_iterator<_OtherIterator, _Sequence>& __other,
|
2014-03-22 02:54:06 +08:00
|
|
|
const _Safe_iterator<_OtherIterator, _Sequence>&)
|
2013-08-02 03:54:46 +08:00
|
|
|
{ return __it._M_get_sequence() != __other._M_get_sequence(); }
|
2014-03-22 02:54:06 +08:00
|
|
|
|
|
|
|
/** Handle debug iterators from different types of container. */
|
|
|
|
template<typename _Iterator, typename _Sequence, typename _OtherIterator,
|
|
|
|
typename _OtherSequence>
|
|
|
|
inline bool
|
|
|
|
__foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
|
|
|
const _Safe_iterator<_OtherIterator, _OtherSequence>&,
|
|
|
|
const _Safe_iterator<_OtherIterator, _OtherSequence>&)
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
/* Handle non-debug iterators. */
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _Iterator, typename _Sequence, typename _InputIterator>
|
|
|
|
inline bool
|
|
|
|
__foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
2014-03-22 02:54:06 +08:00
|
|
|
const _InputIterator& __other,
|
|
|
|
const _InputIterator& __other_end)
|
2013-08-02 03:54:46 +08:00
|
|
|
{
|
2014-10-16 04:40:31 +08:00
|
|
|
#if __cplusplus < 201103L
|
|
|
|
typedef _Is_contiguous_sequence<_Sequence> __tag;
|
|
|
|
#else
|
|
|
|
using __lvalref = std::is_lvalue_reference<
|
|
|
|
typename std::iterator_traits<_InputIterator>::reference>;
|
|
|
|
using __contiguous = _Is_contiguous_sequence<_Sequence>;
|
|
|
|
using __tag = typename std::conditional<__lvalref::value, __contiguous,
|
|
|
|
std::__false_type>::type;
|
|
|
|
#endif
|
|
|
|
return __foreign_iterator_aux3(__it, __other, __other_end, __tag());
|
2013-08-02 03:54:46 +08:00
|
|
|
}
|
2014-03-22 02:54:06 +08:00
|
|
|
|
|
|
|
/* Handle the case where we aren't really inserting a range after all */
|
|
|
|
template<typename _Iterator, typename _Sequence, typename _Integral>
|
2013-08-02 03:54:46 +08:00
|
|
|
inline bool
|
2014-03-22 02:54:06 +08:00
|
|
|
__foreign_iterator_aux(const _Safe_iterator<_Iterator, _Sequence>&,
|
|
|
|
_Integral, _Integral,
|
2013-08-02 03:54:46 +08:00
|
|
|
std::__true_type)
|
|
|
|
{ return true; }
|
|
|
|
|
2014-03-22 02:54:06 +08:00
|
|
|
/* Handle all iterators. */
|
2013-08-02 03:54:46 +08:00
|
|
|
template<typename _Iterator, typename _Sequence,
|
|
|
|
typename _InputIterator>
|
|
|
|
inline bool
|
|
|
|
__foreign_iterator_aux(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
2014-03-22 02:54:06 +08:00
|
|
|
_InputIterator __other, _InputIterator __other_end,
|
2013-08-02 03:54:46 +08:00
|
|
|
std::__false_type)
|
|
|
|
{
|
2014-03-22 02:54:06 +08:00
|
|
|
return _Insert_range_from_self_is_safe<_Sequence>::__value
|
2015-07-17 03:17:26 +08:00
|
|
|
|| __foreign_iterator_aux2(__it, std::__miter_base(__other),
|
|
|
|
std::__miter_base(__other_end));
|
2013-08-02 03:54:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence,
|
|
|
|
typename _InputIterator>
|
|
|
|
inline bool
|
|
|
|
__foreign_iterator(const _Safe_iterator<_Iterator, _Sequence>& __it,
|
2014-03-22 02:54:06 +08:00
|
|
|
_InputIterator __other, _InputIterator __other_end)
|
2013-08-02 03:54:46 +08:00
|
|
|
{
|
|
|
|
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
|
2014-03-22 02:54:06 +08:00
|
|
|
return __foreign_iterator_aux(__it, __other, __other_end, _Integral());
|
2013-08-02 03:54:46 +08:00
|
|
|
}
|
|
|
|
|
2005-05-27 23:01:45 +08:00
|
|
|
/** Checks that __s is non-NULL or __n == 0, and then returns __s. */
|
|
|
|
template<typename _CharT, typename _Integer>
|
|
|
|
inline const _CharT*
|
mt_allocator.h (__mt_alloc::__mt_alloc): Remove name of unused parameter.
2005-12-26 Chris Jefferson <chris@bubblescope.net>
* include/ext/mt_allocator.h (__mt_alloc::__mt_alloc): Remove
name of unused parameter.
* include/bits/stream_iterator.h (istream_iterator::istream_iterator):
Construct _M_value.
* include/debug/functions.h (__check_valid_range): Add
__attribute__((unused)).
* include/tr1/hashtable (hashtable::end): Remove name of unused
parameter.
* include/tr1/tuple_iterate.h (tuple::tuple): Likewise.
(tuple::operator=): Add __attribute__((unused)).
* include/tr1/functional (Fnv_hash<4>::hash): Add static_cast.
(Fnv_hash<8>::hash): Likewise.
* testsuite/25_algorithms/iter_swap/20577.cc (swap): Remove name of
unused parameter.
* testsuite/25_algorithms/unique_copy/check_type.cc (S2::S2,X2::X2):
Likewise.
* testsuite/22_locale/ctype/narrow/char/19955.cc (do_narrow): Likewise.
* testsuite/22_locale/ctype/is/char/9858.cc (Derived::do_is,
Derived::do_scan_is, Derived::do_scan_not, Derived2::do_is,
Derived2::do_scan_is, Derived2::do_scan_not): Likewise.
* testsuite/22_locale/time_put/put/wchar_t/12439_1.cc (TP::do_put):
Likewise.
* testsuite/22_locale/time_put/put/wchar_t/12439_3.cc (TP::do_put):
Likewise.
* testsuite/22_locale/time_put/put/char/12439_1.cc (TP::do_put):
Likewise.
* testsuite/22_locale/time_put/put/char/12439_3.cc (TP::do_put):
Likewise.
* testsuite/testsuite_io.h (fail_num_get::do_get, fail_num_put::do_put):
Likewise.
* testsuite/25_algorithms/find/17441.cc (find): Likewise.
* testsuite/23_containers/vector/cons/clear_allocator.cc
(clear_alloc::clear_alloc): Likewise.
* testsuite/23_containers/vector/bool/clear_allocator.cc
(clear_alloc::clear_alloc): Likewise.
* testsuite/23_containers/list/cons/clear_allocator.cc
(clear_alloc::clear_alloc): Likewise.
* testsuite/23_containers/set/modifiers/16728.cc (test_container):
Likewise.
* testsuite/27_io/basic_ios/cons/char/3.cc (char_traits::to_char_type,
to_int_type): Likewise.
* testsuite/27_io/basic_filebuf/imbue/12206.cc (codecvt::do_out, do_in,
do_unshift, do_length): Likewise.
* testsuite/21_strings/basic_string/capacity/1.cc
(operator==(A<T>,A<T>), operator<(A<T>,A<T>),
char_traits::to_char_type, char_traits::to_int_type): Likewise
* testsuite/testsuite_character.h (ctype::do_is, ctype::do_scan_is,
ctype::do_scan_not, do_toupper, do_tolower): Likewise.
* testsuite/25_algorithms/replace_copy/check_type.cc (Z::operator=):
Add missing return statement.
* testsuite/25_algorithms/replace_copy_if/check_type.cc (Z::operator=):
Likewise.
* testsuite/testsuite_iterators.h (output_iterator_wrapper::operator=,
random_access_iterator_wrapper::operator==): Likewise.
* testsuite/20_util/functional/binders/1.cc (s::f_int_int_const,
s::f_int_int, s::f_int_void_const, s::f_int_void): Likewise.
* testsuite/27_io/types/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/write/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/write/char/1.cc (test01): Likewise.
* testsuite/21_strings/c_strings/wchar_t/24559.cc (main): Likewise.
* testsuite/27_io/basic_istream/ignore/wchar_t/2.cc (check): Add static
cast.
* testsuite/27_io/basic_istream/ignore/char/2.cc (check): Likewise.
* testsuite/27_io/basic_istream/getline/wchar_t/5.cc (check): Likewise.
* testsuite/27_io/basic_istream/getline/char/5.cc (check): Likewise.
* testsuite/testsuite_allocator.h (check_new): Likewise.
(check_deallocate_null): Add missing return value.
* testsuite/ext/pool_allocator/allocate_chunk.cc (test01):
Make variable unsigned.
* testsuite/23_containers/vector/modifiers/erase/1.cc (N,N1,N2,N3,N4,
N5,test01): Likewise.
* testsuite/26_numerics/valarray/valarray_subset_assignment.cc
(check_array): Likewise.
(main): Removed unused variable.
* testsuite/27_io/basic_streambuf/in_avail/wchar_t/1.cc (test05):
Removed unused variable.
* testsuite/27_io/basic_ostream/flush/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/flush/char/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/endl/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/endl/char/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/ends/wchar_t/1.cc (test01): Likewise.
* testsuite/27_io/basic_ostream/ends/char/1.cc (test01): Likewise.
* testsuite/tr1/2_general_utilities/memory/shared_ptr/
assign/shared_ptr.cc (test01): Correct return type.
* testsuite/27_io/basic_filebuf/close/char/2.cc (test_02):
Add default value to close_num.
From-SVN: r109062
2005-12-26 18:53:42 +08:00
|
|
|
__check_string(const _CharT* __s,
|
|
|
|
const _Integer& __n __attribute__((__unused__)))
|
2005-05-27 23:01:45 +08:00
|
|
|
{
|
|
|
|
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
[multiple changes]
2010-08-29 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/23_containers/bitset/invalidation: Move...
* testsuite/23_containers/bitset/debug/invalidation: ... here.
* testsuite/23_containers/deque/invalidation: Move...
* testsuite/23_containers/deque/debug/invalidation: ... here.
* testsuite/23_containers/list/invalidation: Move...
* testsuite/23_containers/list/debug/invalidation: ... here.
* testsuite/23_containers/map/invalidation: Move...
* testsuite/23_containers/map/debug/invalidation: ... here.
* testsuite/23_containers/multimap/invalidation: Move...
* testsuite/23_containers/multimap/debug/invalidation: ... here.
* testsuite/23_containers/set/invalidation: Move...
* testsuite/23_containers/set/debug/invalidation: ... here.
* testsuite/23_containers/multiset/invalidation: Move...
* testsuite/23_containers/multiset/debug/invalidation: ... here.
* testsuite/23_containers/vector/invalidation: Move...
* testsuite/23_containers/vector/debug/invalidation: ... here.
2010-08-29 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (_Iter_base): Move...
* include/bits/stl_iterator_base_types.h: ...here.
* include/debug/functions.h (__check_valid_range, __check_string,
__check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include
formatter.h and use formatting macros for a consistent debug result.
* include/debug/formatter.h (__check_singular): Declare; do not
include debug.h.
* include/debug/debug.h: Do not include formatter.h.
* include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator)
rename to iterator_type.
(__gnu_debug::__base): Add.
* include/debug/set.h: Use everywhere __gnu_debug::__base once
iterator range valided.
* include/debug/unordered_map: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/vector: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/deque: Likewise.
* include/debug/map.h: Likewise.
* include/debug/string: Likewise.
* include/debug/list: Likewise.
* include/debug/multimap.h: Likewise.
* testsuite/23_containers/util/debug/assign_neg.h: New test cases on
debug checks performed on container assign operation.
* testsuite/23_containers/util/debug/construct_neg.h: New test cases
on debug checks on constructors.
* testsuite/23_containers/util/debug/insert_neg.h: New test cases on
debug checks performed on container insert operations.
* testsuite/23_containers/unordered_map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: New.
* testsuite/23_containers/multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/vector/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/deque/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/list/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
list_construct1.cc: New, validate performance impact of the patch
on the debug mode.
* testsuite/performance/23_containers/range_construct/
list_construct2.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
vector_construct.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
deque_construct.cc: Likewise.
From-SVN: r163628
2010-08-30 01:39:00 +08:00
|
|
|
__glibcxx_assert(__s != 0 || __n == 0);
|
2005-05-27 23:01:45 +08:00
|
|
|
#endif
|
|
|
|
return __s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Checks that __s is non-NULL and then returns __s. */
|
|
|
|
template<typename _CharT>
|
|
|
|
inline const _CharT*
|
|
|
|
__check_string(const _CharT* __s)
|
|
|
|
{
|
|
|
|
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
[multiple changes]
2010-08-29 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/23_containers/bitset/invalidation: Move...
* testsuite/23_containers/bitset/debug/invalidation: ... here.
* testsuite/23_containers/deque/invalidation: Move...
* testsuite/23_containers/deque/debug/invalidation: ... here.
* testsuite/23_containers/list/invalidation: Move...
* testsuite/23_containers/list/debug/invalidation: ... here.
* testsuite/23_containers/map/invalidation: Move...
* testsuite/23_containers/map/debug/invalidation: ... here.
* testsuite/23_containers/multimap/invalidation: Move...
* testsuite/23_containers/multimap/debug/invalidation: ... here.
* testsuite/23_containers/set/invalidation: Move...
* testsuite/23_containers/set/debug/invalidation: ... here.
* testsuite/23_containers/multiset/invalidation: Move...
* testsuite/23_containers/multiset/debug/invalidation: ... here.
* testsuite/23_containers/vector/invalidation: Move...
* testsuite/23_containers/vector/debug/invalidation: ... here.
2010-08-29 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (_Iter_base): Move...
* include/bits/stl_iterator_base_types.h: ...here.
* include/debug/functions.h (__check_valid_range, __check_string,
__check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include
formatter.h and use formatting macros for a consistent debug result.
* include/debug/formatter.h (__check_singular): Declare; do not
include debug.h.
* include/debug/debug.h: Do not include formatter.h.
* include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator)
rename to iterator_type.
(__gnu_debug::__base): Add.
* include/debug/set.h: Use everywhere __gnu_debug::__base once
iterator range valided.
* include/debug/unordered_map: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/vector: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/deque: Likewise.
* include/debug/map.h: Likewise.
* include/debug/string: Likewise.
* include/debug/list: Likewise.
* include/debug/multimap.h: Likewise.
* testsuite/23_containers/util/debug/assign_neg.h: New test cases on
debug checks performed on container assign operation.
* testsuite/23_containers/util/debug/construct_neg.h: New test cases
on debug checks on constructors.
* testsuite/23_containers/util/debug/insert_neg.h: New test cases on
debug checks performed on container insert operations.
* testsuite/23_containers/unordered_map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: New.
* testsuite/23_containers/multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/vector/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/deque/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/list/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
list_construct1.cc: New, validate performance impact of the patch
on the debug mode.
* testsuite/performance/23_containers/range_construct/
list_construct2.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
vector_construct.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
deque_construct.cc: Likewise.
From-SVN: r163628
2010-08-30 01:39:00 +08:00
|
|
|
__glibcxx_assert(__s != 0);
|
2005-05-27 23:01:45 +08:00
|
|
|
#endif
|
|
|
|
return __s;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can't check if an input iterator sequence is sorted, because we
|
|
|
|
// can't step through the sequence.
|
|
|
|
template<typename _InputIterator>
|
|
|
|
inline bool
|
|
|
|
__check_sorted_aux(const _InputIterator&, const _InputIterator&,
|
|
|
|
std::input_iterator_tag)
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
// Can verify if a forward iterator sequence is in fact sorted using
|
|
|
|
// std::__is_sorted
|
|
|
|
template<typename _ForwardIterator>
|
|
|
|
inline bool
|
|
|
|
__check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
std::forward_iterator_tag)
|
|
|
|
{
|
|
|
|
if (__first == __last)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
_ForwardIterator __next = __first;
|
2015-05-23 19:17:38 +08:00
|
|
|
for (++__next; __next != __last; __first = __next, (void)++__next)
|
2005-05-27 23:01:45 +08:00
|
|
|
if (*__next < *__first)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can't check if an input iterator sequence is sorted, because we can't step
|
|
|
|
// through the sequence.
|
|
|
|
template<typename _InputIterator, typename _Predicate>
|
|
|
|
inline bool
|
|
|
|
__check_sorted_aux(const _InputIterator&, const _InputIterator&,
|
|
|
|
_Predicate, std::input_iterator_tag)
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
// Can verify if a forward iterator sequence is in fact sorted using
|
|
|
|
// std::__is_sorted
|
|
|
|
template<typename _ForwardIterator, typename _Predicate>
|
|
|
|
inline bool
|
|
|
|
__check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
_Predicate __pred, std::forward_iterator_tag)
|
|
|
|
{
|
|
|
|
if (__first == __last)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
_ForwardIterator __next = __first;
|
2015-05-23 19:17:38 +08:00
|
|
|
for (++__next; __next != __last; __first = __next, (void)++__next)
|
2005-05-27 23:01:45 +08:00
|
|
|
if (__pred(*__next, *__first))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determine if a sequence is sorted.
|
|
|
|
template<typename _InputIterator>
|
|
|
|
inline bool
|
|
|
|
__check_sorted(const _InputIterator& __first, const _InputIterator& __last)
|
|
|
|
{
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
// Verify that the < operator for elements in the sequence is a
|
|
|
|
// StrictWeakOrdering by checking that it is irreflexive.
|
[multiple changes]
2010-08-29 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/23_containers/bitset/invalidation: Move...
* testsuite/23_containers/bitset/debug/invalidation: ... here.
* testsuite/23_containers/deque/invalidation: Move...
* testsuite/23_containers/deque/debug/invalidation: ... here.
* testsuite/23_containers/list/invalidation: Move...
* testsuite/23_containers/list/debug/invalidation: ... here.
* testsuite/23_containers/map/invalidation: Move...
* testsuite/23_containers/map/debug/invalidation: ... here.
* testsuite/23_containers/multimap/invalidation: Move...
* testsuite/23_containers/multimap/debug/invalidation: ... here.
* testsuite/23_containers/set/invalidation: Move...
* testsuite/23_containers/set/debug/invalidation: ... here.
* testsuite/23_containers/multiset/invalidation: Move...
* testsuite/23_containers/multiset/debug/invalidation: ... here.
* testsuite/23_containers/vector/invalidation: Move...
* testsuite/23_containers/vector/debug/invalidation: ... here.
2010-08-29 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (_Iter_base): Move...
* include/bits/stl_iterator_base_types.h: ...here.
* include/debug/functions.h (__check_valid_range, __check_string,
__check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include
formatter.h and use formatting macros for a consistent debug result.
* include/debug/formatter.h (__check_singular): Declare; do not
include debug.h.
* include/debug/debug.h: Do not include formatter.h.
* include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator)
rename to iterator_type.
(__gnu_debug::__base): Add.
* include/debug/set.h: Use everywhere __gnu_debug::__base once
iterator range valided.
* include/debug/unordered_map: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/vector: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/deque: Likewise.
* include/debug/map.h: Likewise.
* include/debug/string: Likewise.
* include/debug/list: Likewise.
* include/debug/multimap.h: Likewise.
* testsuite/23_containers/util/debug/assign_neg.h: New test cases on
debug checks performed on container assign operation.
* testsuite/23_containers/util/debug/construct_neg.h: New test cases
on debug checks on constructors.
* testsuite/23_containers/util/debug/insert_neg.h: New test cases on
debug checks performed on container insert operations.
* testsuite/23_containers/unordered_map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: New.
* testsuite/23_containers/multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/vector/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/deque/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/list/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
list_construct1.cc: New, validate performance impact of the patch
on the debug mode.
* testsuite/performance/23_containers/range_construct/
list_construct2.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
vector_construct.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
deque_construct.cc: Likewise.
From-SVN: r163628
2010-08-30 01:39:00 +08:00
|
|
|
__glibcxx_assert(__first == __last || !(*__first < *__first));
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
|
2012-05-12 03:21:31 +08:00
|
|
|
return __check_sorted_aux(__first, __last,
|
|
|
|
std::__iterator_category(__first));
|
2005-05-27 23:01:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _InputIterator, typename _Predicate>
|
|
|
|
inline bool
|
|
|
|
__check_sorted(const _InputIterator& __first, const _InputIterator& __last,
|
|
|
|
_Predicate __pred)
|
|
|
|
{
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
// Verify that the predicate is StrictWeakOrdering by checking that it
|
|
|
|
// is irreflexive.
|
[multiple changes]
2010-08-29 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/23_containers/bitset/invalidation: Move...
* testsuite/23_containers/bitset/debug/invalidation: ... here.
* testsuite/23_containers/deque/invalidation: Move...
* testsuite/23_containers/deque/debug/invalidation: ... here.
* testsuite/23_containers/list/invalidation: Move...
* testsuite/23_containers/list/debug/invalidation: ... here.
* testsuite/23_containers/map/invalidation: Move...
* testsuite/23_containers/map/debug/invalidation: ... here.
* testsuite/23_containers/multimap/invalidation: Move...
* testsuite/23_containers/multimap/debug/invalidation: ... here.
* testsuite/23_containers/set/invalidation: Move...
* testsuite/23_containers/set/debug/invalidation: ... here.
* testsuite/23_containers/multiset/invalidation: Move...
* testsuite/23_containers/multiset/debug/invalidation: ... here.
* testsuite/23_containers/vector/invalidation: Move...
* testsuite/23_containers/vector/debug/invalidation: ... here.
2010-08-29 François Dumont <francois.cppdevs@free.fr>
* include/bits/stl_algobase.h (_Iter_base): Move...
* include/bits/stl_iterator_base_types.h: ...here.
* include/debug/functions.h (__check_valid_range, __check_string,
__check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include
formatter.h and use formatting macros for a consistent debug result.
* include/debug/formatter.h (__check_singular): Declare; do not
include debug.h.
* include/debug/debug.h: Do not include formatter.h.
* include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator)
rename to iterator_type.
(__gnu_debug::__base): Add.
* include/debug/set.h: Use everywhere __gnu_debug::__base once
iterator range valided.
* include/debug/unordered_map: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/vector: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/deque: Likewise.
* include/debug/map.h: Likewise.
* include/debug/string: Likewise.
* include/debug/list: Likewise.
* include/debug/multimap.h: Likewise.
* testsuite/23_containers/util/debug/assign_neg.h: New test cases on
debug checks performed on container assign operation.
* testsuite/23_containers/util/debug/construct_neg.h: New test cases
on debug checks on constructors.
* testsuite/23_containers/util/debug/insert_neg.h: New test cases on
debug checks performed on container insert operations.
* testsuite/23_containers/unordered_map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: New.
* testsuite/23_containers/multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multimap/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_set/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/unordered_multiset/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/map/debug/cont_traits.h,
debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/vector/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/deque/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/23_containers/list/debug/cont_traits.h,
debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc,
assign4_neg.cc, construct1_neg.cc, construct2_neg.cc,
construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc,
insert3_neg.cc, insert4_neg.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
list_construct1.cc: New, validate performance impact of the patch
on the debug mode.
* testsuite/performance/23_containers/range_construct/
list_construct2.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
vector_construct.cc: Likewise.
* testsuite/performance/23_containers/range_construct/
deque_construct.cc: Likewise.
From-SVN: r163628
2010-08-30 01:39:00 +08:00
|
|
|
__glibcxx_assert(__first == __last || !__pred(*__first, *__first));
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
|
2012-05-12 03:21:31 +08:00
|
|
|
return __check_sorted_aux(__first, __last, __pred,
|
|
|
|
std::__iterator_category(__first));
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
}
|
|
|
|
|
2008-03-14 01:35:40 +08:00
|
|
|
template<typename _InputIterator>
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
inline bool
|
2008-03-14 01:35:40 +08:00
|
|
|
__check_sorted_set_aux(const _InputIterator& __first,
|
|
|
|
const _InputIterator& __last,
|
|
|
|
std::__true_type)
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
{ return __check_sorted(__first, __last); }
|
|
|
|
|
2008-03-14 01:35:40 +08:00
|
|
|
template<typename _InputIterator>
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
inline bool
|
2008-03-14 01:35:40 +08:00
|
|
|
__check_sorted_set_aux(const _InputIterator&,
|
|
|
|
const _InputIterator&,
|
|
|
|
std::__false_type)
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
{ return true; }
|
|
|
|
|
2008-03-14 01:35:40 +08:00
|
|
|
template<typename _InputIterator, typename _Predicate>
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
inline bool
|
2008-03-14 01:35:40 +08:00
|
|
|
__check_sorted_set_aux(const _InputIterator& __first,
|
|
|
|
const _InputIterator& __last,
|
|
|
|
_Predicate __pred, std::__true_type)
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
{ return __check_sorted(__first, __last, __pred); }
|
|
|
|
|
2008-03-14 01:35:40 +08:00
|
|
|
template<typename _InputIterator, typename _Predicate>
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
inline bool
|
2008-03-14 01:35:40 +08:00
|
|
|
__check_sorted_set_aux(const _InputIterator&,
|
|
|
|
const _InputIterator&, _Predicate,
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
std::__false_type)
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
// ... special variant used in std::merge, std::includes, std::set_*.
|
|
|
|
template<typename _InputIterator1, typename _InputIterator2>
|
|
|
|
inline bool
|
|
|
|
__check_sorted_set(const _InputIterator1& __first,
|
|
|
|
const _InputIterator1& __last,
|
|
|
|
const _InputIterator2&)
|
|
|
|
{
|
|
|
|
typedef typename std::iterator_traits<_InputIterator1>::value_type
|
|
|
|
_ValueType1;
|
|
|
|
typedef typename std::iterator_traits<_InputIterator2>::value_type
|
|
|
|
_ValueType2;
|
|
|
|
|
|
|
|
typedef typename std::__are_same<_ValueType1, _ValueType2>::__type
|
|
|
|
_SameType;
|
|
|
|
return __check_sorted_set_aux(__first, __last, _SameType());
|
2005-05-27 23:01:45 +08:00
|
|
|
}
|
|
|
|
|
re PR libstdc++/34730 (Legal program doesn't compile with -D_GLIBCXX_DEBUG)
2008-01-12 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/34730
* include/debug/functions.h (__check_sorted_set,
__check_sorted_set_aux): Add.
(__check_sorted): Check StrictWeakOrdering.
* include/debug/macros.h (__glibcxx_check_strict_weak_ordering,
__glibcxx_check_strict_weak_ordering_pred): Remove.
(__glibcxx_check_sorted, __glibcxx_check_sorted_pred): Adjust.
(__glibcxx_check_sorted_set, __glibcxx_check_sorted_set_pred): Add.
* include/debug/debug.h (__glibcxx_requires_sorted_set,
__glibcxx_requires_sorted_set_pred): Add.
* include/bits/stl_algo.h (merge, includes, set_union,
set_intersection, set_difference, set_symmetric_difference):
Adjust, use __glibcxx_requires_sorted_set* instead.
* testsuite/25_algorithms/set_intersection/34730.cc: New.
From-SVN: r131500
2008-01-13 09:34:58 +08:00
|
|
|
template<typename _InputIterator1, typename _InputIterator2,
|
|
|
|
typename _Predicate>
|
|
|
|
inline bool
|
|
|
|
__check_sorted_set(const _InputIterator1& __first,
|
|
|
|
const _InputIterator1& __last,
|
|
|
|
const _InputIterator2&, _Predicate __pred)
|
|
|
|
{
|
|
|
|
typedef typename std::iterator_traits<_InputIterator1>::value_type
|
|
|
|
_ValueType1;
|
|
|
|
typedef typename std::iterator_traits<_InputIterator2>::value_type
|
|
|
|
_ValueType2;
|
|
|
|
|
|
|
|
typedef typename std::__are_same<_ValueType1, _ValueType2>::__type
|
|
|
|
_SameType;
|
|
|
|
return __check_sorted_set_aux(__first, __last, __pred, _SameType());
|
|
|
|
}
|
|
|
|
|
2013-08-31 04:16:03 +08:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 270. Binary search requirements overly strict
|
|
|
|
// Determine if a sequence is partitioned w.r.t. this element.
|
2005-05-27 23:01:45 +08:00
|
|
|
template<typename _ForwardIterator, typename _Tp>
|
|
|
|
inline bool
|
2013-08-31 04:16:03 +08:00
|
|
|
__check_partitioned_lower(_ForwardIterator __first,
|
|
|
|
_ForwardIterator __last, const _Tp& __value)
|
2005-05-27 23:01:45 +08:00
|
|
|
{
|
|
|
|
while (__first != __last && *__first < __value)
|
|
|
|
++__first;
|
2012-08-04 03:34:49 +08:00
|
|
|
if (__first != __last)
|
|
|
|
{
|
|
|
|
++__first;
|
|
|
|
while (__first != __last && !(*__first < __value))
|
|
|
|
++__first;
|
|
|
|
}
|
2005-05-27 23:01:45 +08:00
|
|
|
return __first == __last;
|
|
|
|
}
|
|
|
|
|
2007-10-03 08:34:40 +08:00
|
|
|
template<typename _ForwardIterator, typename _Tp>
|
|
|
|
inline bool
|
2013-08-31 04:16:03 +08:00
|
|
|
__check_partitioned_upper(_ForwardIterator __first,
|
2007-10-03 08:34:40 +08:00
|
|
|
_ForwardIterator __last, const _Tp& __value)
|
|
|
|
{
|
|
|
|
while (__first != __last && !(__value < *__first))
|
|
|
|
++__first;
|
2012-08-04 03:34:49 +08:00
|
|
|
if (__first != __last)
|
|
|
|
{
|
|
|
|
++__first;
|
|
|
|
while (__first != __last && __value < *__first)
|
|
|
|
++__first;
|
|
|
|
}
|
2007-10-03 08:34:40 +08:00
|
|
|
return __first == __last;
|
|
|
|
}
|
|
|
|
|
2013-08-31 04:16:03 +08:00
|
|
|
// Determine if a sequence is partitioned w.r.t. this element.
|
2005-05-27 23:01:45 +08:00
|
|
|
template<typename _ForwardIterator, typename _Tp, typename _Pred>
|
|
|
|
inline bool
|
2013-08-31 04:16:03 +08:00
|
|
|
__check_partitioned_lower(_ForwardIterator __first,
|
|
|
|
_ForwardIterator __last, const _Tp& __value,
|
|
|
|
_Pred __pred)
|
2007-10-03 08:34:40 +08:00
|
|
|
{
|
|
|
|
while (__first != __last && bool(__pred(*__first, __value)))
|
|
|
|
++__first;
|
2012-08-04 03:34:49 +08:00
|
|
|
if (__first != __last)
|
|
|
|
{
|
|
|
|
++__first;
|
|
|
|
while (__first != __last && !bool(__pred(*__first, __value)))
|
|
|
|
++__first;
|
|
|
|
}
|
2007-10-03 08:34:40 +08:00
|
|
|
return __first == __last;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _ForwardIterator, typename _Tp, typename _Pred>
|
|
|
|
inline bool
|
2013-08-31 04:16:03 +08:00
|
|
|
__check_partitioned_upper(_ForwardIterator __first,
|
2007-10-03 08:34:40 +08:00
|
|
|
_ForwardIterator __last, const _Tp& __value,
|
|
|
|
_Pred __pred)
|
2005-05-27 23:01:45 +08:00
|
|
|
{
|
2007-10-03 08:34:40 +08:00
|
|
|
while (__first != __last && !bool(__pred(__value, *__first)))
|
2005-05-27 23:01:45 +08:00
|
|
|
++__first;
|
2012-08-04 03:34:49 +08:00
|
|
|
if (__first != __last)
|
|
|
|
{
|
|
|
|
++__first;
|
|
|
|
while (__first != __last && bool(__pred(__value, *__first)))
|
|
|
|
++__first;
|
|
|
|
}
|
2005-05-27 23:01:45 +08:00
|
|
|
return __first == __last;
|
|
|
|
}
|
2012-05-12 03:21:31 +08:00
|
|
|
|
2015-08-26 04:27:03 +08:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
struct _Irreflexive_checker
|
|
|
|
{
|
|
|
|
template<typename _It>
|
|
|
|
static typename std::iterator_traits<_It>::reference
|
|
|
|
__deref();
|
|
|
|
|
|
|
|
template<typename _It,
|
|
|
|
typename = decltype(__deref<_It>() < __deref<_It>())>
|
|
|
|
static bool
|
|
|
|
_S_is_valid(_It __it)
|
|
|
|
{ return !(*__it < *__it); }
|
|
|
|
|
|
|
|
// Fallback method if operator doesn't exist.
|
|
|
|
template<typename... _Args>
|
|
|
|
static bool
|
|
|
|
_S_is_valid(_Args...)
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
template<typename _It, typename _Pred, typename
|
|
|
|
= decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
|
|
|
|
static bool
|
|
|
|
_S_is_valid_pred(_It __it, _Pred __pred)
|
|
|
|
{ return !__pred(*__it, *__it); }
|
|
|
|
|
|
|
|
// Fallback method if predicate can't be invoked.
|
|
|
|
template<typename... _Args>
|
|
|
|
static bool
|
|
|
|
_S_is_valid_pred(_Args...)
|
|
|
|
{ return true; }
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _Iterator>
|
|
|
|
inline bool
|
|
|
|
__is_irreflexive(_Iterator __it)
|
|
|
|
{ return _Irreflexive_checker::_S_is_valid(__it); }
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Pred>
|
|
|
|
inline bool
|
|
|
|
__is_irreflexive_pred(_Iterator __it, _Pred __pred)
|
|
|
|
{ return _Irreflexive_checker::_S_is_valid_pred(__it, __pred); }
|
|
|
|
#endif
|
|
|
|
|
2005-05-27 23:01:45 +08:00
|
|
|
} // namespace __gnu_debug
|
|
|
|
|
|
|
|
#endif
|