3 // Copyright (C) 2005-2013 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 3, or (at your option) any later
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
23 // Permission to use, copy, modify, sell, and distribute this software
24 // is hereby granted without fee, provided that the above copyright
25 // notice appears in all copies, and that both that copyright notice
26 // and this permission notice appear in supporting documentation. None
27 // of the above authors, nor IBM Haifa Research Laboratories, make any
28 // representation about the suitability of this software for any
29 // purpose. It is provided "as is" without express or implied
33 * @file assoc_link_regression_test_1.cpp
34 * A linkage regression test.
38 #include <ext/pb_ds/assoc_container.hpp>
43 using namespace __gnu_pbds
;
46 * The following function performs a sequence of operations on an
47 * associative container object mapping integers to characters.
49 template<typename Cntnr
>
51 some_op_sequence(Cntnr
& r_c
)
54 assert(r_c
.size() == 0);
56 r_c
.insert(make_pair(1, 'a'));
61 assert(r_c
.size() == 2);
63 cout
<< "Key 1 is mapped to " << r_c
[1] << endl
;
64 cout
<< "Key 2 is mapped to " << r_c
[2] << endl
;
66 cout
<< endl
<< "All value types in the container:" << endl
;
67 for (typename
Cntnr::const_iterator it
= r_c
.begin(); it
!= r_c
.end(); ++it
)
68 cout
<< it
->first
<< " -> " << it
->second
<< endl
;
75 assert(r_c
.size() == 0);
79 assoc_link_regression_test_0()
82 // Perform operations on a collision-chaining hash map.
83 cc_hash_table
<int, char> c
;
88 // Perform operations on a general-probing hash map.
89 gp_hash_table
<int, char> c
;
94 // Perform operations on a red-black tree map.
100 // Perform operations on a splay tree map.
101 tree
<int, char, less
<int>, splay_tree_tag
> c
;
106 // Perform operations on a splay tree map.
107 tree
<int, char, less
<int>, ov_tree_tag
> c
;
112 // Perform operations on a list-update map.
113 list_update
<int, char> c
;
120 assoc_link_regression_test_1()
123 // Perform operations on a collision-chaining hash map.
124 cc_hash_table
<int, char> c
;
129 // Perform operations on a general-probing hash map.
130 gp_hash_table
<int, char> c
;
135 // Perform operations on a red-black tree map.
141 // Perform operations on a splay tree map.
142 tree
<int, char, less
<int>, splay_tree_tag
> c
;
147 // Perform operations on a splay tree map.
148 tree
<int, char, less
<int>, ov_tree_tag
> c
;
153 // Perform operations on a list-update map.
154 list_update
<int, char> c
;
162 assoc_link_regression_test_0();
163 assoc_link_regression_test_1();