aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/vstring.h
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-03-05 01:15:28 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-03-05 01:15:28 +0000
commit2203cb90fb793e384645e390e3a4112c47a7cb1d (patch)
tree6c290c31ed518698ccc30d08c831ee001d0cde00 /libstdc++-v3/include/ext/vstring.h
parent8e4ac5321ebf94ea8f6e39f436d3efef5fd01dd2 (diff)
downloadgcc-2203cb90fb793e384645e390e3a4112c47a7cb1d.zip
gcc-2203cb90fb793e384645e390e3a4112c47a7cb1d.tar.gz
gcc-2203cb90fb793e384645e390e3a4112c47a7cb1d.tar.bz2
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
Diffstat (limited to 'libstdc++-v3/include/ext/vstring.h')
-rw-r--r--libstdc++-v3/include/ext/vstring.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 8c4120a..48e3d46 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -1,6 +1,6 @@
// 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.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -238,7 +238,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __end End of range.
* @param __a Allocator to use (default is default allocator).
*/
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<class _InputIterator,
+ typename = std::_RequireInputIter<_InputIterator>>
+#else
template<class _InputIterator>
+#endif
__versa_string(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a = _Alloc())
: __vstring_base(__beg, __end, __a) { }
@@ -762,7 +767,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* 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>
+#endif
__versa_string&
append(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_iend(), _M_iend(), __first, __last); }
@@ -886,7 +896,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Sets value of string to characters in the range
* [first,last).
*/
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<class _InputIterator,
+ typename = std::_RequireInputIter<_InputIterator>>
+#else
template<class _InputIterator>
+#endif
__versa_string&
assign(_InputIterator __first, _InputIterator __last)
{ return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
@@ -931,7 +946,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* thrown. The value of the string doesn't change if an error
* is thrown.
*/
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<class _InputIterator,
+ typename = std::_RequireInputIter<_InputIterator>>
+#else
template<class _InputIterator>
+#endif
void
insert(iterator __p, _InputIterator __beg, _InputIterator __end)
{ this->replace(__p, __p, __beg, __end); }
@@ -1367,6 +1387,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* of result exceeds max_size(), length_error is thrown. The
* 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>
__versa_string&
replace(iterator __i1, iterator __i2,
@@ -1378,6 +1412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
}
+#endif
// Specializations for the common case of pointer and iterator:
// useful to avoid the overhead of temporary buffering in _M_replace.