diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2008-06-29 11:08:26 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2008-06-29 11:08:26 +0000 |
commit | b03717765d0d62af54bdb3112ac90ca6d7dd7c75 (patch) | |
tree | ec2900173d09b74441a6e8de7b2c0420c8765de3 | |
parent | 7dfab247a1147b532dbf4934e88c36f296cd42da (diff) | |
download | gcc-b03717765d0d62af54bdb3112ac90ca6d7dd7c75.zip gcc-b03717765d0d62af54bdb3112ac90ca6d7dd7c75.tar.gz gcc-b03717765d0d62af54bdb3112ac90ca6d7dd7c75.tar.bz2 |
stl_algo.h (copy_n): Add in C++0x mode.
2008-06-29 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_algo.h (copy_n): Add in C++0x mode.
* include/bits/algorithmfwd.h: Add.
* include/bits/stl_uninitialized.h (uninitialized_copy_n): Add
in C++0x mode.
* testsuite/20_util/specialized_algorithms/uninitialized_copy_n/
move_iterators/1.cc: New
* testsuite/25_algorithms/headers/algorithm/synopsis.cc: Update.
* testsuite/25_algorithms/copy_n/1.cc: New.
* testsuite/25_algorithms/copy_n/2.cc: Likewise.
* testsuite/25_algorithms/copy_n/3.cc: Likewise.
* testsuite/25_algorithms/copy_n/4.cc: Likewise.
* testsuite/25_algorithms/copy_n/move_iterators/1.cc: Likewise.
* testsuite/25_algorithms/copy_n/requirements/
explicit_instantiation/2.cc: Likewise.
* testsuite/25_algorithms/partition_point/requirements/
explicit_instantiation/pod.cc: Likewise.
From-SVN: r137251
13 files changed, 569 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c8c6af9..efb05ea 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,22 @@ +2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/stl_algo.h (copy_n): Add in C++0x mode. + * include/bits/algorithmfwd.h: Add. + * include/bits/stl_uninitialized.h (uninitialized_copy_n): Add + in C++0x mode. + * testsuite/20_util/specialized_algorithms/uninitialized_copy_n/ + move_iterators/1.cc: New + * testsuite/25_algorithms/headers/algorithm/synopsis.cc: Update. + * testsuite/25_algorithms/copy_n/1.cc: New. + * testsuite/25_algorithms/copy_n/2.cc: Likewise. + * testsuite/25_algorithms/copy_n/3.cc: Likewise. + * testsuite/25_algorithms/copy_n/4.cc: Likewise. + * testsuite/25_algorithms/copy_n/move_iterators/1.cc: Likewise. + * testsuite/25_algorithms/copy_n/requirements/ + explicit_instantiation/2.cc: Likewise. + * testsuite/25_algorithms/partition_point/requirements/ + explicit_instantiation/pod.cc: Likewise. + 2008-06-28 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_algo.h (partition_point): Add in C++0x mode. diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h index 23c4970..6fefe46 100644 --- a/libstdc++-v3/include/bits/algorithmfwd.h +++ b/libstdc++-v3/include/bits/algorithmfwd.h @@ -31,6 +31,7 @@ copy copy_backward copy_if (C++0x) + copy_n (C++0x) count count_if equal @@ -149,6 +150,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _IIter, typename _OIter, typename _Predicate> _OIter copy_if(_IIter, _IIter, _OIter, _Predicate); + + template<typename _IIter, typename _Size, typename _OIter> + _OIter + copy_n(_IIter, _Size, _OIter); #endif // count diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 61f7003..40ce60b 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -975,6 +975,53 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return __result; } + + template<typename _InputIterator, typename _Size, typename _OutputIterator> + _OutputIterator + __copy_n(_InputIterator __first, _Size __n, + _OutputIterator __result, input_iterator_tag) + { + for (; __n > 0; --__n) + { + *__result = *__first; + ++__first; + ++__result; + } + return __result; + } + + template<typename _RandomAccessIterator, typename _Size, + typename _OutputIterator> + inline _OutputIterator + __copy_n(_RandomAccessIterator __first, _Size __n, + _OutputIterator __result, random_access_iterator_tag) + { return std::copy(__first, __first + __n, __result); } + + /** + * @brief Copies the range [first,first+n) into [result,result+n). + * @param first An input iterator. + * @param n The number of elements to copy. + * @param result An output iterator. + * @return result+n. + * + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). + */ + template<typename _InputIterator, typename _Size, typename _OutputIterator> + inline _OutputIterator + copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + + return std::__copy_n(__first, __n, __result, + std::__iterator_category(__first)); + } + /** * @brief Copy the elements of a sequence to separate output sequences * depending on the truth value of a predicate. diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index 88dac3a..af51264 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -1,6 +1,6 @@ // Raw memory manipulators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -431,6 +431,53 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _InputIterator, typename _Size, + typename _ForwardIterator> + _ForwardIterator + __uninitialized_copy_n(_InputIterator __first, _Size __n, + _ForwardIterator __result, input_iterator_tag) + { + _ForwardIterator __cur = __result; + try + { + for (; __n > 0; --__n, ++__first, ++__cur) + ::new(static_cast<void*>(&*__cur)) typename + iterator_traits<_ForwardIterator>::value_type(*__first); + return __cur; + } + catch(...) + { + std::_Destroy(__result, __cur); + __throw_exception_again; + } + } + + template<typename _RandomAccessIterator, typename _Size, + typename _ForwardIterator> + inline _ForwardIterator + __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n, + _ForwardIterator __result, + random_access_iterator_tag) + { return std::uninitialized_copy(__first, __first + __n, __result); } + + /** + * @brief Copies the range [first,first+n) into result. + * @param first An input iterator. + * @param n The number of elements to copy. + * @param result An output iterator. + * @return result + n + * + * Like copy_n(), but does not require an initialized output range. + */ + template<typename _InputIterator, typename _Size, typename _ForwardIterator> + inline _ForwardIterator + uninitialized_copy_n(_InputIterator __first, _Size __n, + _ForwardIterator __result) + { return std::__uninitialized_copy_n(__first, __n, __result, + std::__iterator_category(__first)); } +#endif + _GLIBCXX_END_NAMESPACE #endif /* _STL_UNINITIALIZED_H */ diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc new file mode 100644 index 0000000..bbe36f3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc @@ -0,0 +1,68 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <iterator> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::input_iterator_wrapper; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::uninitialized_copy_n; + +typedef test_container<rvalstruct, input_iterator_wrapper> container_in; +typedef test_container<rvalstruct, forward_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + uninitialized_copy_n(std::move_iterator<input_iterator_wrapper<rvalstruct> >(incon.begin()), + size, outcon.begin()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/1.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/1.cc new file mode 100644 index 0000000..03af136 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/1.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <vector> +#include <testsuite_hooks.h> + +void +test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + const int N = sizeof(A) / sizeof(int); + + int i1[N]; + copy_n(A, N, i1); + VERIFY( equal(i1, i1 + N, A) ); + + vector<int> v1(N); + copy_n(A, N, v1.begin()); + VERIFY( equal(v1.begin(), v1.end(), A) ); + + short s1[N]; + copy_n(A, N, s1); + VERIFY( equal(s1, s1 + N, A) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/2.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/2.cc new file mode 100644 index 0000000..23cf929 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/2.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <vector> +#include <testsuite_hooks.h> + +void +test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + const int N = sizeof(A) / sizeof(int); + const vector<int> a(A, A + N); + + int i1[N]; + copy_n(a.begin(), N, i1); + VERIFY( equal(i1, i1 + N, a.begin()) ); + + vector<int> v1(N); + copy_n(a.begin(), N, v1.begin()); + VERIFY( equal(v1.begin(), v1.end(), a.begin()) ); + + short s1[N]; + copy_n(a.begin(), N, s1); + VERIFY( equal(s1, s1 + N, a.begin()) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/3.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/3.cc new file mode 100644 index 0000000..14bb356 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/3.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <vector> +#include <deque> +#include <testsuite_hooks.h> + +void +test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + const int N = sizeof(A) / sizeof(int); + const deque<int> a(A, A + N); + + int i1[N]; + copy_n(a.begin(), N, i1); + VERIFY( equal(i1, i1 + N, a.begin()) ); + + vector<int> v1(N); + copy_n(a.begin(), N, v1.begin()); + VERIFY( equal(v1.begin(), v1.end(), a.begin()) ); + + short s1[N]; + copy_n(a.begin(), N, s1); + VERIFY( equal(s1, s1 + N, a.begin()) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/4.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/4.cc new file mode 100644 index 0000000..9320b7e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/4.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <vector> +#include <list> +#include <testsuite_hooks.h> + +void +test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + const int N = sizeof(A) / sizeof(int); + const list<int> a(A, A + N); + + int i1[N]; + copy_n(a.begin(), N, i1); + VERIFY( equal(i1, i1 + N, a.begin()) ); + + vector<int> v1(N); + copy_n(a.begin(), N, v1.begin()); + VERIFY( equal(v1.begin(), v1.end(), a.begin()) ); + + short s1[N]; + copy_n(a.begin(), N, s1); + VERIFY( equal(s1, s1 + N, a.begin()) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/move_iterators/1.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/move_iterators/1.cc new file mode 100644 index 0000000..08b26d4 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/move_iterators/1.cc @@ -0,0 +1,67 @@ +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <iterator> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::input_iterator_wrapper; +using __gnu_test::output_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::copy_n; + +typedef test_container<rvalstruct, input_iterator_wrapper> container_in; +typedef test_container<rvalstruct, output_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + copy_n(std::move_iterator<input_iterator_wrapper<rvalstruct> >(incon.begin()), + size, outcon.begin()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/requirements/explicit_instantiation/2.cc new file mode 100644 index 0000000..004479c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2008-06-29 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, or (at your option) +// 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. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + template iterator_type copy_n(iterator_type, size_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/requirements/explicit_instantiation/pod.cc new file mode 100644 index 0000000..64a68de --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2008-06-24 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2008 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 2, or (at your option) +// 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. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + template iterator_type copy_n(iterator_type, size_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc index 005892d..2d73e6f 100644 --- a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc @@ -217,6 +217,10 @@ namespace std _OIter copy_if(_IIter, _IIter, _OIter, _Predicate); + template<typename _IIter, typename _Size, typename _OIter> + _OIter + copy_n(_IIter, _Size, _OIter); + template<typename _IIter, typename _OIter1, typename _OIter2, typename _Predicate> pair<_OIter1, _OIter2> |