Commit 2203cb90 by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/43813 ([DR1234] vector<T*>(3, NULL) fails to compile)

2012-03-04  Paolo Carlini  <paolo.carlini@oracle.com>
	    Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/43813
	* include/bits/stl_iterator_base_types.h (_RequireInputIter): New.
	* include/ext/vstring.h (__versa_string<>::__versa_string
	(_InputIterator, _InputIterator, const _Alloc&),
	__versa_string<>::append(_InputIterator, _InputIterator),
	__versa_string<>::assign(_InputIterator, _InputIterator),
	__versa_string<>::insert(iterator, _InputIterator,
	_InputIterator), __versa_string<>::replace(iterator, iterator,
	_InputIterator, _InputIterator)): Use it.
	* include/bits/stl_list.h (list<>::list(_InputIterator,
	_InputIterator, const allocator_type&), list<>::assign(_InputIterator,
	_InputIterator), list<>::insert(iterator, _InputIterator,
	_InputIterator)): Likewise.
	* include/bits/stl_vector.h (vector<>::vector(_InputIterator,
	_InputIterator, const allocator_type&), vector<>::assign(_InputIterator,
	_InputIterator), vectort<>::insert(iterator, _InputIterator,
	_InputIterator)): Likewise.
	* include/bits/stl_deque.h (deque<>::deque(_InputIterator,
	_InputIterator, const allocator_type&), deque<>::deque(_InputIterator,
	_InputIterator), deque<>::insert(iterator, _InputIterator,
	_InputIterator)): Likewise.
	* include/bits/stl_bvector.h (vector<>::vector(_InputIterator,
	_InputIterator, const allocator_type&), vector<>::deque(_InputIterator,
	_InputIterator), vector<>::insert(iterator, _InputIterator,
	_InputIterator)): Likewise.
	* include/bits/forward_list.h (forward_list<>::forward_list
	(_InputIterator, _InputIterator, const allocator_type&),
	forward_list<>::assign(_InputIterator, _InputIterator),
	forward_list<>::insert_after(const_iterator, _InputIterator,
	_InputIterator)): Likewise.
	(forward_list<>::_M_initialize_dispatch(,, __true_type): Remove.
	(forward_list<>::_M_range_initialize): Add, adjust everywhere.
	* include/bits/forward_list.tcc: Adjust.
	* include/debug/forward_list: Adjust.
	* include/debug/vector: Likewise.
	* include/debug/deque: Likewise.
	* include/debug/list: Likewise.
	* testsuite/ext/vstring/requirements/do_the_right_thing.cc: New.
	* testsuite/23_containers/forward_list/requirements/
	do_the_right_thing.cc: Likewise.
	* testsuite/23_containers/vector/requirements/
	do_the_right_thing.cc: Likewise.
	* testsuite/23_containers/deque/requirements/
	do_the_right_thing.cc: Likewise.
	* testsuite/23_containers/list/requirements/
	do_the_right_thing.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/
	assign_neg.cc: Adjust dg-error line number.
	* testsuite/23_containers/forward_list/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	assign_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	assign_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	assign_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	insert_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.

Co-Authored-By: Jonathan Wakely <jwakely.gcc@gmail.com>

From-SVN: r184911
parent 8e4ac532
2012-03-04 Paolo Carlini <paolo.carlini@oracle.com>
Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/43813
* include/bits/stl_iterator_base_types.h (_RequireInputIter): New.
* include/ext/vstring.h (__versa_string<>::__versa_string
(_InputIterator, _InputIterator, const _Alloc&),
__versa_string<>::append(_InputIterator, _InputIterator),
__versa_string<>::assign(_InputIterator, _InputIterator),
__versa_string<>::insert(iterator, _InputIterator,
_InputIterator), __versa_string<>::replace(iterator, iterator,
_InputIterator, _InputIterator)): Use it.
* include/bits/stl_list.h (list<>::list(_InputIterator,
_InputIterator, const allocator_type&), list<>::assign(_InputIterator,
_InputIterator), list<>::insert(iterator, _InputIterator,
_InputIterator)): Likewise.
* include/bits/stl_vector.h (vector<>::vector(_InputIterator,
_InputIterator, const allocator_type&), vector<>::assign(_InputIterator,
_InputIterator), vectort<>::insert(iterator, _InputIterator,
_InputIterator)): Likewise.
* include/bits/stl_deque.h (deque<>::deque(_InputIterator,
_InputIterator, const allocator_type&), deque<>::deque(_InputIterator,
_InputIterator), deque<>::insert(iterator, _InputIterator,
_InputIterator)): Likewise.
* include/bits/stl_bvector.h (vector<>::vector(_InputIterator,
_InputIterator, const allocator_type&), vector<>::deque(_InputIterator,
_InputIterator), vector<>::insert(iterator, _InputIterator,
_InputIterator)): Likewise.
* include/bits/forward_list.h (forward_list<>::forward_list
(_InputIterator, _InputIterator, const allocator_type&),
forward_list<>::assign(_InputIterator, _InputIterator),
forward_list<>::insert_after(const_iterator, _InputIterator,
_InputIterator)): Likewise.
(forward_list<>::_M_initialize_dispatch(,, __true_type): Remove.
(forward_list<>::_M_range_initialize): Add, adjust everywhere.
* include/bits/forward_list.tcc: Adjust.
* include/debug/forward_list: Adjust.
* include/debug/vector: Likewise.
* include/debug/deque: Likewise.
* include/debug/list: Likewise.
* testsuite/ext/vstring/requirements/do_the_right_thing.cc: New.
* testsuite/23_containers/forward_list/requirements/
do_the_right_thing.cc: Likewise.
* testsuite/23_containers/vector/requirements/
do_the_right_thing.cc: Likewise.
* testsuite/23_containers/deque/requirements/
do_the_right_thing.cc: Likewise.
* testsuite/23_containers/list/requirements/
do_the_right_thing.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Adjust dg-error line number.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
assign_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
assign_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
assign_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
insert_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2012-03-04 Jonathan Wakely <jwakely.gcc@gmail.com> 2012-03-04 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/52433 PR libstdc++/52433
......
// <forward_list.h> -*- C++ -*- // <forward_list.h> -*- C++ -*-
// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -499,15 +499,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -499,15 +499,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* [@a __first,@a __last). This is linear in N (where N is * [@a __first,@a __last). This is linear in N (where N is
* distance(@a __first,@a __last)). * distance(@a __first,@a __last)).
*/ */
template<typename _InputIterator> template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
forward_list(_InputIterator __first, _InputIterator __last, forward_list(_InputIterator __first, _InputIterator __last,
const _Alloc& __al = _Alloc()) const _Alloc& __al = _Alloc())
: _Base(_Node_alloc_type(__al)) : _Base(_Node_alloc_type(__al))
{ { _M_range_initialize(__first, __last); }
// Check whether it's an integral type. If so, it's not an iterator.
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
}
/** /**
* @brief The %forward_list copy constructor. * @brief The %forward_list copy constructor.
...@@ -519,7 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -519,7 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/ */
forward_list(const forward_list& __list) forward_list(const forward_list& __list)
: _Base(__list._M_get_Node_allocator()) : _Base(__list._M_get_Node_allocator())
{ _M_initialize_dispatch(__list.begin(), __list.end(), __false_type()); } { _M_range_initialize(__list.begin(), __list.end()); }
/** /**
* @brief The %forward_list move constructor. * @brief The %forward_list move constructor.
...@@ -544,7 +541,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -544,7 +541,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
forward_list(std::initializer_list<_Tp> __il, forward_list(std::initializer_list<_Tp> __il,
const _Alloc& __al = _Alloc()) const _Alloc& __al = _Alloc())
: _Base(_Node_alloc_type(__al)) : _Base(_Node_alloc_type(__al))
{ _M_initialize_dispatch(__il.begin(), __il.end(), __false_type()); } { _M_range_initialize(__il.begin(), __il.end()); }
/** /**
* @brief The forward_list dtor. * @brief The forward_list dtor.
...@@ -609,8 +606,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -609,8 +606,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* that the resulting %forward_list's size is the same as the number * that the resulting %forward_list's size is the same as the number
* of elements assigned. Old data may be lost. * of elements assigned. Old data may be lost.
*/ */
template<typename _InputIterator> template<typename _InputIterator,
void typename = std::_RequireInputIter<_InputIterator>>
void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
clear(); clear();
...@@ -905,7 +903,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -905,7 +903,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* This operation is linear in the number of elements inserted and * This operation is linear in the number of elements inserted and
* does not invalidate iterators and references. * does not invalidate iterators and references.
*/ */
template<typename _InputIterator> template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
iterator iterator
insert_after(const_iterator __pos, insert_after(const_iterator __pos,
_InputIterator __first, _InputIterator __last); _InputIterator __first, _InputIterator __last);
...@@ -1207,16 +1206,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1207,16 +1206,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ this->_M_impl._M_head._M_reverse_after(); } { this->_M_impl._M_head._M_reverse_after(); }
private: private:
template<typename _Integer>
void
_M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
{ _M_fill_initialize(static_cast<size_type>(__n), __x); }
// Called by the range constructor to implement [23.1.1]/9 // Called by the range constructor to implement [23.1.1]/9
template<typename _InputIterator> template<typename _InputIterator>
void void
_M_initialize_dispatch(_InputIterator __first, _InputIterator __last, _M_range_initialize(_InputIterator __first, _InputIterator __last);
__false_type);
// Called by forward_list(n,v,a), and the range constructor when it // Called by forward_list(n,v,a), and the range constructor when it
// turns out to be the same thing. // turns out to be the same thing.
......
// <forward_list.tcc> -*- C++ -*- // <forward_list.tcc> -*- C++ -*-
// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -100,8 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -100,8 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _InputIterator> template<typename _InputIterator>
void void
forward_list<_Tp, _Alloc>:: forward_list<_Tp, _Alloc>::
_M_initialize_dispatch(_InputIterator __first, _InputIterator __last, _M_range_initialize(_InputIterator __first, _InputIterator __last)
__false_type)
{ {
_Node_base* __to = &this->_M_impl._M_head; _Node_base* __to = &this->_M_impl._M_head;
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
...@@ -111,8 +110,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -111,8 +110,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
} }
// Called by forward_list(n,v,a), and the range constructor // Called by forward_list(n,v,a).
// when it turns out to be the same thing.
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
void void
forward_list<_Tp, _Alloc>:: forward_list<_Tp, _Alloc>::
...@@ -258,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -258,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
template<typename _InputIterator> template<typename _InputIterator, typename>
typename forward_list<_Tp, _Alloc>::iterator typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>:: forward_list<_Tp, _Alloc>::
insert_after(const_iterator __pos, insert_after(const_iterator __pos,
......
// vector<bool> specialization -*- C++ -*- // vector<bool> specialization -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
// 2011 Free Software Foundation, Inc. // 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -557,6 +557,14 @@ template<typename _Alloc> ...@@ -557,6 +557,14 @@ template<typename _Alloc>
} }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
vector(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ _M_initialize_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
vector(_InputIterator __first, _InputIterator __last, vector(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
...@@ -565,6 +573,7 @@ template<typename _Alloc> ...@@ -565,6 +573,7 @@ template<typename _Alloc>
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral()); _M_initialize_dispatch(__first, __last, _Integral());
} }
#endif
~vector() _GLIBCXX_NOEXCEPT { } ~vector() _GLIBCXX_NOEXCEPT { }
...@@ -610,6 +619,13 @@ template<typename _Alloc> ...@@ -610,6 +619,13 @@ template<typename _Alloc>
assign(size_type __n, const bool& __x) assign(size_type __n, const bool& __x)
{ _M_fill_assign(__n, __x); } { _M_fill_assign(__n, __x); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
assign(_InputIterator __first, _InputIterator __last)
{ _M_assign_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -617,6 +633,7 @@ template<typename _Alloc> ...@@ -617,6 +633,7 @@ template<typename _Alloc>
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral()); _M_assign_dispatch(__first, __last, _Integral());
} }
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
void void
...@@ -806,6 +823,14 @@ template<typename _Alloc> ...@@ -806,6 +823,14 @@ template<typename _Alloc>
return begin() + __n; return begin() + __n;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
insert(iterator __position,
_InputIterator __first, _InputIterator __last)
{ _M_insert_dispatch(__position, __first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
insert(iterator __position, insert(iterator __position,
...@@ -814,6 +839,7 @@ template<typename _Alloc> ...@@ -814,6 +839,7 @@ template<typename _Alloc>
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral()); _M_insert_dispatch(__position, __first, __last, _Integral());
} }
#endif
void void
insert(iterator __position, size_type __n, const bool& __x) insert(iterator __position, size_type __n, const bool& __x)
......
// Deque implementation -*- C++ -*- // Deque implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
// 2011 Free Software Foundation, Inc. // 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -888,6 +888,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -888,6 +888,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* input iterators are used, then this will do at most 2N calls to the * input iterators are used, then this will do at most 2N calls to the
* copy constructor, and logN memory reallocations. * copy constructor, and logN memory reallocations.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
deque(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ _M_initialize_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
deque(_InputIterator __first, _InputIterator __last, deque(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
...@@ -897,6 +905,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -897,6 +905,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral()); _M_initialize_dispatch(__first, __last, _Integral());
} }
#endif
/** /**
* The dtor only erases the elements, and note that if the elements * The dtor only erases the elements, and note that if the elements
...@@ -979,6 +988,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -979,6 +988,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* resulting %deque's size is the same as the number of elements * resulting %deque's size is the same as the number of elements
* assigned. Old data may be lost. * assigned. Old data may be lost.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
assign(_InputIterator __first, _InputIterator __last)
{ _M_assign_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -986,6 +1002,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -986,6 +1002,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral()); _M_assign_dispatch(__first, __last, _Integral());
} }
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
/** /**
...@@ -1510,6 +1527,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1510,6 +1527,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* [__first,__last) into the %deque before the location specified * [__first,__last) into the %deque before the location specified
* by @a __position. This is known as <em>range insert</em>. * by @a __position. This is known as <em>range insert</em>.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
insert(iterator __position, _InputIterator __first,
_InputIterator __last)
{ _M_insert_dispatch(__position, __first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
insert(iterator __position, _InputIterator __first, insert(iterator __position, _InputIterator __first,
...@@ -1519,6 +1544,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1519,6 +1544,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral()); _M_insert_dispatch(__position, __first, __last, _Integral());
} }
#endif
/** /**
* @brief Remove element at given position. * @brief Remove element at given position.
......
// Types used in iterator implementation -*- C++ -*- // Types used in iterator implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
// 2010, 2011, 2012
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -65,7 +66,7 @@ ...@@ -65,7 +66,7 @@
#include <bits/c++config.h> #include <bits/c++config.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
# include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE # include <type_traits> // For _GLIBCXX_HAS_NESTED_TYPE, is_convertible
#endif #endif
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
...@@ -222,6 +223,14 @@ _GLIBCXX_HAS_NESTED_TYPE(iterator_category) ...@@ -222,6 +223,14 @@ _GLIBCXX_HAS_NESTED_TYPE(iterator_category)
{ return __it.base(); } { return __it.base(); }
}; };
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InIter>
using _RequireInputIter = typename
enable_if<is_convertible<typename
iterator_traits<_InIter>::iterator_category,
input_iterator_tag>::value>::type;
#endif
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace } // namespace
......
// List implementation -*- C++ -*- // List implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
// 2011 Free Software Foundation, Inc. // 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -638,6 +638,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -638,6 +638,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* [@a __first,@a __last). This is linear in N (where N is * [@a __first,@a __last). This is linear in N (where N is
* distance(@a __first,@a __last)). * distance(@a __first,@a __last)).
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
list(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(_Node_alloc_type(__a))
{ _M_initialize_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
list(_InputIterator __first, _InputIterator __last, list(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
...@@ -647,6 +655,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -647,6 +655,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral()); _M_initialize_dispatch(__first, __last, _Integral());
} }
#endif
/** /**
* No explicit dtor needed as the _Base dtor takes care of * No explicit dtor needed as the _Base dtor takes care of
...@@ -725,6 +734,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -725,6 +734,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* that the resulting %list's size is the same as the number of * that the resulting %list's size is the same as the number of
* elements assigned. Old data may be lost. * elements assigned. Old data may be lost.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
assign(_InputIterator __first, _InputIterator __last)
{ _M_assign_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -733,6 +749,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -733,6 +749,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral()); _M_assign_dispatch(__first, __last, _Integral());
} }
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
/** /**
...@@ -1148,7 +1165,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1148,7 +1165,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* This operation is linear in the number of elements inserted and * This operation is linear in the number of elements inserted and
* does not invalidate iterators and references. * does not invalidate iterators and references.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator> template<typename _InputIterator>
#endif
void void
insert(iterator __position, _InputIterator __first, insert(iterator __position, _InputIterator __first,
_InputIterator __last) _InputIterator __last)
......
// Vector implementation -*- C++ -*- // Vector implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
// 2011 Free Software Foundation, Inc. // 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -383,6 +383,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -383,6 +383,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* used, then this will do at most 2N calls to the copy * used, then this will do at most 2N calls to the copy
* constructor, and logN memory reallocations. * constructor, and logN memory reallocations.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
vector(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
{ _M_initialize_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
vector(_InputIterator __first, _InputIterator __last, vector(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
...@@ -392,6 +400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -392,6 +400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_initialize_dispatch(__first, __last, _Integral()); _M_initialize_dispatch(__first, __last, _Integral());
} }
#endif
/** /**
* The dtor only erases the elements, and note that if the * The dtor only erases the elements, and note that if the
...@@ -497,6 +506,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -497,6 +506,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* that the resulting %vector's size is the same as the number * that the resulting %vector's size is the same as the number
* of elements assigned. Old data may be lost. * of elements assigned. Old data may be lost.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
assign(_InputIterator __first, _InputIterator __last)
{ _M_assign_dispatch(__first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -505,6 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -505,6 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral()); _M_assign_dispatch(__first, __last, _Integral());
} }
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
/** /**
...@@ -1035,6 +1052,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1035,6 +1052,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* %vector and if it is frequently used the user should * %vector and if it is frequently used the user should
* consider using std::list. * consider using std::list.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
void
insert(iterator __position, _InputIterator __first,
_InputIterator __last)
{ _M_insert_dispatch(__position, __first, __last, __false_type()); }
#else
template<typename _InputIterator> template<typename _InputIterator>
void void
insert(iterator __position, _InputIterator __first, insert(iterator __position, _InputIterator __first,
...@@ -1044,6 +1069,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1044,6 +1069,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral()); _M_insert_dispatch(__position, __first, __last, _Integral());
} }
#endif
/** /**
* @brief Remove element at given position. * @brief Remove element at given position.
......
// Debugging deque implementation -*- C++ -*- // Debugging deque implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
// 2012
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -88,7 +89,12 @@ namespace __debug ...@@ -88,7 +89,12 @@ namespace __debug
: _Base(__n, __value, __a) { } : _Base(__n, __value, __a) { }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
deque(_InputIterator __first, _InputIterator __last, deque(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
...@@ -142,7 +148,12 @@ namespace __debug ...@@ -142,7 +148,12 @@ namespace __debug
} }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
...@@ -413,7 +424,12 @@ namespace __debug ...@@ -413,7 +424,12 @@ namespace __debug
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
void void
insert(iterator __position, insert(iterator __position,
_InputIterator __first, _InputIterator __last) _InputIterator __first, _InputIterator __last)
......
// <forward_list> -*- C++ -*- // <forward_list> -*- C++ -*-
// Copyright (C) 2010 Free Software Foundation, Inc. // Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -91,8 +91,9 @@ namespace __debug ...@@ -91,8 +91,9 @@ namespace __debug
: _Base(__n, __value, __al) : _Base(__n, __value, __al)
{ } { }
template<typename _InputIterator> template<typename _InputIterator,
forward_list(_InputIterator __first, _InputIterator __last, typename = std::_RequireInputIter<_InputIterator>>
forward_list(_InputIterator __first, _InputIterator __last,
const _Alloc& __al = _Alloc()) const _Alloc& __al = _Alloc())
: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
__last)), __last)),
...@@ -143,8 +144,9 @@ namespace __debug ...@@ -143,8 +144,9 @@ namespace __debug
return *this; return *this;
} }
template<typename _InputIterator> template<typename _InputIterator,
void typename = std::_RequireInputIter<_InputIterator>>
void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
...@@ -273,7 +275,8 @@ namespace __debug ...@@ -273,7 +275,8 @@ namespace __debug
this); this);
} }
template<typename _InputIterator> template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
iterator iterator
insert_after(const_iterator __pos, insert_after(const_iterator __pos,
_InputIterator __first, _InputIterator __last) _InputIterator __first, _InputIterator __last)
......
// Debugging list implementation -*- C++ -*- // Debugging list implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
// 2012
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -89,14 +90,18 @@ namespace __debug ...@@ -89,14 +90,18 @@ namespace __debug
: _Base(__n, __value, __a) { } : _Base(__n, __value, __a) { }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
list(_InputIterator __first, _InputIterator __last, #endif
const _Allocator& __a = _Allocator()) list(_InputIterator __first, _InputIterator __last,
: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, const _Allocator& __a = _Allocator())
__last)), : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
__gnu_debug::__base(__last), __a) __last)),
{ } __gnu_debug::__base(__last), __a)
{ }
list(const list& __x) list(const list& __x)
: _Base(__x) { } : _Base(__x) { }
...@@ -151,7 +156,12 @@ namespace __debug ...@@ -151,7 +156,12 @@ namespace __debug
} }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
...@@ -405,7 +415,12 @@ namespace __debug ...@@ -405,7 +415,12 @@ namespace __debug
_Base::insert(__position.base(), __n, __x); _Base::insert(__position.base(), __n, __x);
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
void void
insert(iterator __position, _InputIterator __first, insert(iterator __position, _InputIterator __first,
_InputIterator __last) _InputIterator __last)
......
// Debugging vector implementation -*- C++ -*- // Debugging vector implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
// 2012
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -95,7 +96,12 @@ namespace __debug ...@@ -95,7 +96,12 @@ namespace __debug
: _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { } : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
vector(_InputIterator __first, _InputIterator __last, vector(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
...@@ -170,7 +176,12 @@ namespace __debug ...@@ -170,7 +176,12 @@ namespace __debug
} }
#endif #endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<typename _InputIterator> template<typename _InputIterator>
#endif
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
...@@ -476,7 +487,12 @@ namespace __debug ...@@ -476,7 +487,12 @@ namespace __debug
_M_update_guaranteed_capacity(); _M_update_guaranteed_capacity();
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
void void
insert(iterator __position, insert(iterator __position,
_InputIterator __first, _InputIterator __last) _InputIterator __first, _InputIterator __last)
......
// Versatile string -*- C++ -*- // Versatile string -*- C++ -*-
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -238,7 +238,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -238,7 +238,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __end End of range. * @param __end End of range.
* @param __a Allocator to use (default is default allocator). * @param __a Allocator to use (default is default allocator).
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
__versa_string(_InputIterator __beg, _InputIterator __end, __versa_string(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a = _Alloc()) const _Alloc& __a = _Alloc())
: __vstring_base(__beg, __end, __a) { } : __vstring_base(__beg, __end, __a) { }
...@@ -762,7 +767,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -762,7 +767,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* *
* Appends characters in the range [first,last) to this string. * Appends characters in the range [first,last) to this string.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
__versa_string& __versa_string&
append(_InputIterator __first, _InputIterator __last) append(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_iend(), _M_iend(), __first, __last); } { return this->replace(_M_iend(), _M_iend(), __first, __last); }
...@@ -886,7 +896,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -886,7 +896,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Sets value of string to characters in the range * Sets value of string to characters in the range
* [first,last). * [first,last).
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
__versa_string& __versa_string&
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_ibegin(), _M_iend(), __first, __last); } { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
...@@ -931,7 +946,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -931,7 +946,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* thrown. The value of the string doesn't change if an error * thrown. The value of the string doesn't change if an error
* is thrown. * is thrown.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
#else
template<class _InputIterator> template<class _InputIterator>
#endif
void void
insert(iterator __p, _InputIterator __beg, _InputIterator __end) insert(iterator __p, _InputIterator __beg, _InputIterator __end)
{ this->replace(__p, __p, __beg, __end); } { this->replace(__p, __p, __beg, __end); }
...@@ -1367,6 +1387,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1367,6 +1387,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* of result exceeds max_size(), length_error is thrown. The * of result exceeds max_size(), length_error is thrown. The
* value of the string doesn't change if an error is thrown. * value of the string doesn't change if an error is thrown.
*/ */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
__versa_string&
replace(iterator __i1, iterator __i2,
_InputIterator __k1, _InputIterator __k2)
{
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
std::__false_type());
}
#else
template<class _InputIterator> template<class _InputIterator>
__versa_string& __versa_string&
replace(iterator __i1, iterator __i2, replace(iterator __i1, iterator __i2,
...@@ -1378,6 +1412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1378,6 +1412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename std::__is_integer<_InputIterator>::__type _Integral; typedef typename std::__is_integer<_InputIterator>::__type _Integral;
return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
} }
#endif
// Specializations for the common case of pointer and iterator: // Specializations for the common case of pointer and iterator:
// useful to avoid the overhead of temporary buffering in _M_replace. // useful to avoid the overhead of temporary buffering in _M_replace.
......
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// Copyright (C) 2012 Free Software Foundation, Inc.
//
// 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
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <deque>
// libstdc++/43813
void test01()
{
std::deque<double*> d(7, 0);
d.assign(7, 0);
d.insert(d.begin(), 7, 0);
}
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1670 } // { dg-error "no matching" "" { target *-*-* } 1696 }
#include <deque> #include <deque>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1603 } // { dg-error "no matching" "" { target *-*-* } 1629 }
#include <deque> #include <deque>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1603 } // { dg-error "no matching" "" { target *-*-* } 1629 }
#include <deque> #include <deque>
#include <utility> #include <utility>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1754 } // { dg-error "no matching" "" { target *-*-* } 1780 }
#include <deque> #include <deque>
......
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2012 Free Software Foundation, Inc.
//
// 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
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <forward_list>
// libstdc++/43813
void test01()
{
std::forward_list<double*> fl(7, 0);
fl.assign(7, 0);
fl.insert_after(fl.before_begin(), 7, 0);
}
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1213 } // { dg-error "no matching" "" { target *-*-* } 33 }
// Copyright (C) 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1213 } // { dg-error "no matching" "" { target *-*-* } 27 }
// Copyright (C) 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1213 } // { dg-error "no matching" "" { target *-*-* } 28 }
// Copyright (C) 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
......
// { dg-do compile } // { dg-do compile }
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-error "no matching" "" { target *-*-* } 1213 } // { dg-error "no matching" "" { target *-*-* } 33 }
// Copyright (C) 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
......
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2012 Free Software Foundation, Inc.
//
// 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
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <list>
// libstdc++/43813
void test01()
{
std::list<double*> l(7, 0);
l.assign(7, 0);
l.insert(l.begin(), 7, 0);
}
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1552 } // { dg-error "no matching" "" { target *-*-* } 1574 }
#include <list> #include <list>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1508 } // { dg-error "no matching" "" { target *-*-* } 1530 }
#include <list> #include <list>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1508 } // { dg-error "no matching" "" { target *-*-* } 1530 }
#include <list> #include <list>
#include <utility> #include <utility>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1508 } // { dg-error "no matching" "" { target *-*-* } 1530 }
#include <list> #include <list>
......
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2012 Free Software Foundation, Inc.
//
// 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
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <vector>
// libstdc++/43813
void test01()
{
std::vector<double*> v(7, 0);
v.assign(7, 0);
v.insert(v.begin(), 7, 0);
}
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1225 } // { dg-error "no matching" "" { target *-*-* } 1251 }
#include <vector> #include <vector>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1155 } // { dg-error "no matching" "" { target *-*-* } 1181 }
#include <vector> #include <vector>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1155 } // { dg-error "no matching" "" { target *-*-* } 1181 }
#include <vector> #include <vector>
#include <utility> #include <utility>
......
// 2007-04-27 Paolo Carlini <pcarlini@suse.de> // 2007-04-27 Paolo Carlini <pcarlini@suse.de>
// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1266 } // { dg-error "no matching" "" { target *-*-* } 1292 }
#include <vector> #include <vector>
......
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2012 Free Software Foundation, Inc.
//
// 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
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <ext/vstring.h>
// libstdc++/43813
void test01()
{
__gnu_cxx::__versa_string<double*> vs(7, 0);
vs.assign(7, 0);
vs.append(7, 0);
vs.insert(vs.begin(), 7, 0);
vs.replace(vs.begin(), vs.end(), 7, 0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment