OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [25_algorithms/] [copy/] [34595.cc] - Blame information for rev 830

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
2
//
3
// This file is part of the GNU ISO C++ Library.  This library is free
4
// software; you can redistribute it and/or modify it under the
5
// terms of the GNU General Public License as published by the
6
// Free Software Foundation; either version 3, or (at your option)
7
// any later version.
8
 
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
 
14
// You should have received a copy of the GNU General Public License along
15
// with this library; see the file COPYING3.  If not see
16
// <http://www.gnu.org/licenses/>.
17
 
18
// 25.2.1 [lib.alg.copy] Copy.
19
 
20
#include <algorithm>
21
#include <testsuite_hooks.h>
22
 
23
class Counting_output_iterator
24
: public std::iterator< std::output_iterator_tag, void, void, void, void >
25
{
26
  std::size_t c;
27
public:
28
  Counting_output_iterator() : c(0) {}
29
  Counting_output_iterator& operator++() { return *this; }
30
  Counting_output_iterator& operator*() { return *this; }
31
 
32
  template <typename T>
33
  void operator=(const T&) { ++c; }
34
 
35
  std::size_t current_counter() const { return c; }
36
};
37
 
38
// libstdc++/34595
39
void test01()
40
{
41
  bool test __attribute__((unused)) = true;
42
 
43
  int t[10] = {0,};
44
  Counting_output_iterator cnt;
45
  std::size_t res = std::copy(t+0, t+5, cnt).current_counter();
46
 
47
  VERIFY( res == 5 );
48
}
49
 
50
int main()
51
{
52
  test01();
53
  return 0;
54
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.