diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-24 18:02:36 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-24 18:02:36 +0000 |
commit | 95e0564c2bd9631d959778d55a3af5a65a4f4b1c (patch) | |
tree | 2800fa308a3c52951e5ba3bd057198eb129fc45c /libstdc++-v3/testsuite | |
parent | 2ee3d047ec3ef45121f00c3c5c3859ff61b7909f (diff) | |
download | gcc-95e0564c2bd9631d959778d55a3af5a65a4f4b1c.tar.gz |
2008-06-24 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_algo.h (remove_if): Cast __pred result to bool.
(copy_if): Add, per N2666.
* testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/
2.cc: New.
* testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/
pod.cc: Likewise.
* testsuite/25_algorithms/headers/algorithm/synopsis.cc: Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137080 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
3 files changed, 106 insertions, 1 deletions
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b71050628d8 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { 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 <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type copy_if(iterator_type, iterator_type, + iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..7433367d733 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { 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 std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type copy_if(iterator_type, iterator_type, + iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc index 4939ebf0bd1..87487b3d8e6 100644 --- a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 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 @@ -115,6 +115,12 @@ namespace std void swap(_Tp&, _Tp& b); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Tp, size_t _Nm> + void + swap(_Tp (&)[_Nm], _Tp (&)[_Nm]); +#endif + template<typename _FIter1, typename _FIter2> _FIter2 swap_ranges(_FIter1 first1, _FIter1, _FIter2); @@ -180,6 +186,12 @@ namespace std _OIter remove_copy_if(_IIter, _IIter, _OIter, _Predicate); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _IIter, typename _OIter, typename _Predicate> + _OIter + copy_if(_IIter, _IIter, _OIter, _Predicate); +#endif + template<typename _FIter> _FIter unique(_FIter, _FIter); |