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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [backward/] [hash_set/] [49060.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-Wno-deprecated" }
2
 
3
#include <backward/hashtable.h>
4
#include <utility>
5
 
6
struct modulo2_hash
7
{
8
  size_t operator()(int const key) const
9
  {
10
    return key % 2;
11
  }
12
};
13
 
14
struct modulo2_eq
15
{
16
  bool operator()(int const left, int const right) const
17
  {
18
    return left % 2 == right % 2;
19
  }
20
};
21
 
22
int main()
23
{
24
  typedef std::_Select1st<std::pair<int const, int> > extract_type;
25
  typedef
26
    __gnu_cxx::hashtable<std::pair<int const, int>, int, modulo2_hash,
27
                         extract_type, modulo2_eq, std::allocator<int> >
28
      table_type;
29
  table_type table(4, modulo2_hash(), modulo2_eq(), extract_type(),
30
                   std::allocator<int>());
31
 
32
  table.insert_equal(std::make_pair(2, 1));
33
  table_type::iterator it(table.insert_equal(std::make_pair(4, 2)));
34
  table.erase(it->first);
35
}

powered by: WebSVN 2.1.0

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