forked from gcc-mirror/gcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2009-12-24 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_deque.h (copy_backward(_Deque_iterator, _Deque_iterator, _Deque_iterator), move_backward(_Deque_iterator, _Deque_iterator, _Deque_iterator)): Declare. * include/bits/deque.tcc: Implement the latter. * testsuite/performance/25_algorithms/ copy_backward_deque_iterators.cc: New. * testsuite/25_algorithms/move_backward/deque_iterators/1.cc: Likewise. * testsuite/25_algorithms/copy_backward/deque_iterators/1.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Adjust dg-error line number. * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155455 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
paolo
committed
Dec 24, 2009
1 parent
4689625
commit 5e11505
Showing
10 changed files
with
287 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
libstdc++-v3/testsuite/25_algorithms/copy_backward/deque_iterators/1.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// 2009-12-24 Paolo Carlini <paolo.carlini@oracle.com> | ||
// | ||
// 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 <algorithm> | ||
#include <deque> | ||
#include <testsuite_hooks.h> | ||
|
||
void test01() | ||
{ | ||
bool test __attribute__((unused)) = true; | ||
using namespace std; | ||
|
||
deque<long> data(200); | ||
for (unsigned i = 0; i < data.size(); ++i) | ||
data[i] = i; | ||
|
||
const deque<long> data_1(data.size(), -1); | ||
|
||
for (unsigned i = 0; i < data.size(); i += 2) | ||
for (unsigned j = i; j <= data.size(); j += 3) | ||
for (unsigned k = 0; k + (j - i) <= data.size(); k += 5) | ||
{ | ||
deque<long> d(data.size(), -1); | ||
copy_backward(data.begin() + i, data.begin() + j, | ||
d.begin() + k + (j - i)); | ||
|
||
VERIFY( equal(data.begin() + i, data.begin() + j, | ||
d.begin() + k) ); | ||
VERIFY( equal(d.begin(), d.begin() + k, data_1.begin()) ); | ||
VERIFY( equal(d.begin() + k + (j - i), d.end(), data_1.begin()) ); | ||
} | ||
} | ||
|
||
int main() | ||
{ | ||
test01(); | ||
return 0; | ||
} |
54 changes: 54 additions & 0 deletions
54
libstdc++-v3/testsuite/25_algorithms/move_backward/deque_iterators/1.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// { dg-options "-std=gnu++0x" } | ||
|
||
// 2009-12-24 Paolo Carlini <paolo.carlini@oracle.com> | ||
// | ||
// 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 <algorithm> | ||
#include <deque> | ||
#include <testsuite_hooks.h> | ||
|
||
void test01() | ||
{ | ||
bool test __attribute__((unused)) = true; | ||
using namespace std; | ||
|
||
deque<long> data(200); | ||
for (unsigned i = 0; i < data.size(); ++i) | ||
data[i] = i; | ||
|
||
const deque<long> data_1(data.size(), -1); | ||
|
||
for (unsigned i = 0; i < data.size(); i += 2) | ||
for (unsigned j = i; j <= data.size(); j += 3) | ||
for (unsigned k = 0; k + (j - i) <= data.size(); k += 5) | ||
{ | ||
deque<long> d(data.size(), -1); | ||
move_backward(data.begin() + i, data.begin() + j, | ||
d.begin() + k + (j - i)); | ||
|
||
VERIFY( equal(data.begin() + i, data.begin() + j, | ||
d.begin() + k) ); | ||
VERIFY( equal(d.begin(), d.begin() + k, data_1.begin()) ); | ||
VERIFY( equal(d.begin() + k + (j - i), d.end(), data_1.begin()) ); | ||
} | ||
} | ||
|
||
int main() | ||
{ | ||
test01(); | ||
return 0; | ||
} |
40 changes: 40 additions & 0 deletions
40
libstdc++-v3/testsuite/performance/25_algorithms/copy_backward_deque_iterators.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 2009-24-12 Paolo Carlini <paolo.carlini@oracle.com> | ||
// | ||
// 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> | ||
#include <testsuite_performance.h> | ||
|
||
int main() | ||
{ | ||
using namespace __gnu_test; | ||
|
||
time_counter time; | ||
resource_counter resource; | ||
|
||
const std::deque<int> data(3000, 3); | ||
|
||
std::deque<int> d(3000, 1); | ||
|
||
start_counters(time, resource); | ||
for (int i = 0; i < 1000; ++i) | ||
for (int j = 0; j < 3000; ++j) | ||
std::copy_backward(data.begin(), data.begin() + j, d.end()); | ||
stop_counters(time, resource); | ||
report_performance(__FILE__, "", time, resource); | ||
|
||
return 0; | ||
} |