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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [ext/] [pb_ds/] [example/] [hash_resize_neg.cc] - Blame information for rev 776

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

Line No. Rev Author Line
1 742 jeremybenn
// { dg-do compile }
2
// -*- C++ -*-
3
 
4
// Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011
5
// Free Software Foundation, Inc.
6
//
7
// This file is part of the GNU ISO C++ Library.  This library is free
8
// software; you can redistribute it and/or modify it under the terms
9
// of the GNU General Public License as published by the Free Software
10
// Foundation; either version 3, or (at your option) any later
11
// version.
12
 
13
// This library is distributed in the hope that it will be useful, but
14
// WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
// General Public License for more details.
17
 
18
// You should have received a copy of the GNU General Public License
19
// along with this library; see the file COPYING3.  If not see
20
// <http://www.gnu.org/licenses/>.
21
 
22
 
23
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
24
 
25
// Permission to use, copy, modify, sell, and distribute this software
26
// is hereby granted without fee, provided that the above copyright
27
// notice appears in all copies, and that both that copyright notice
28
// and this permission notice appear in supporting documentation. None
29
// of the above authors, nor IBM Haifa Research Laboratories, make any
30
// representation about the suitability of this software for any
31
// purpose. It is provided "as is" without express or implied
32
// warranty.
33
 
34
/**
35
 * @file hash_bad_resize_example.cpp
36
 * An example showing how *not* to resize a hash-based container.
37
 */
38
 
39
/**
40
 * This non-compiling example shows wrong use of hash-based
41
 * containers. By default, resize policies don't allow external size
42
 * access.
43
 **/
44
 
45
#include <ext/pb_ds/assoc_container.hpp>
46
 
47
using namespace std;
48
using namespace __gnu_pbds;
49
 
50
int main()
51
{
52
  // A collision-chaining hash table mapping ints to chars.
53
  typedef cc_hash_table< int, char> map_t;
54
 
55
  // A map_t object.
56
  map_t h;
57
 
58
  // The following line won't compile. The resize policy needs to be
59
  // configured to allow external resize (by default, this is not
60
  // available).
61
  h.resize(20); // { dg-error "required from" }
62
}
63
 
64
// { dg-prune-output "include" }

powered by: WebSVN 2.1.0

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