Commit 3c9b5053 by Paolo Carlini Committed by Paolo Carlini

PR libstdc++/24061 (issue 6.19)

2005-10-09  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/24061 (issue 6.19)
	* include/tr1/hashtable (struct node_const_iterator, struct
	hashtable_const_iterator): New, add const variants to enable separate
	overloadings for iterator and const_iterator in unordered_set and
	unordered_multiset (as required by issue 6.19).
	(class hashtable): Change the mutable_iterators template parameter
	to constant_iterators and adjust throughout the logic.
	(hashtable::insert(iterator, const value_type&), erase(iterator)
	erase(iterator, iterator)): New, as per issue 6.19.
	(hashtable::m_erase(node*, node**)): New, called by erase(iterator)
	and erase(const_iterator).
	(hashtable::Insert_Conv_Type): New, used by insert(iterator,
	const value_type&) and insert(const_iterator, const value_type&)
	to delegate the work to insert(const value_type&).
	* include/tr1/unordered_map (class unordered_map, unordered_multimap):
	Adjust typedefs.
	* include/tr1/unordered_set (class unordered_set, unordered_multiset):
	Likewise.
	* testsuite/tr1/6_containers/unordered/erase/24061-map.cc: New.
	* testsuite/tr1/6_containers/unordered/erase/24061-multimap.cc: New.
	* testsuite/tr1/6_containers/unordered/erase/24061-multiset.cc: New.
	* testsuite/tr1/6_containers/unordered/erase/24061-set.cc: New.
	* testsuite/tr1/6_containers/unordered/insert/24061-map.cc: New.
	* testsuite/tr1/6_containers/unordered/insert/24061-multimap.cc: New.
	* testsuite/tr1/6_containers/unordered/insert/24061-multiset.cc: New.
	* testsuite/tr1/6_containers/unordered/insert/24061-set.cc: New.

From-SVN: r105138
parent d8aa8596
2005-10-09 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24061 (issue 6.19)
* include/tr1/hashtable (struct node_const_iterator, struct
hashtable_const_iterator): New, add const variants to enable separate
overloadings for iterator and const_iterator in unordered_set and
unordered_multiset (as required by issue 6.19).
(class hashtable): Change the mutable_iterators template parameter
to constant_iterators and adjust throughout the logic.
(hashtable::insert(iterator, const value_type&), erase(iterator)
erase(iterator, iterator)): New, as per issue 6.19.
(hashtable::m_erase(node*, node**)): New, called by erase(iterator)
and erase(const_iterator).
(hashtable::Insert_Conv_Type): New, used by insert(iterator,
const value_type&) and insert(const_iterator, const value_type&)
to delegate the work to insert(const value_type&).
* include/tr1/unordered_map (class unordered_map, unordered_multimap):
Adjust typedefs.
* include/tr1/unordered_set (class unordered_set, unordered_multiset):
Likewise.
* testsuite/tr1/6_containers/unordered/erase/24061-map.cc: New.
* testsuite/tr1/6_containers/unordered/erase/24061-multimap.cc: New.
* testsuite/tr1/6_containers/unordered/erase/24061-multiset.cc: New.
* testsuite/tr1/6_containers/unordered/erase/24061-set.cc: New.
* testsuite/tr1/6_containers/unordered/insert/24061-map.cc: New.
* testsuite/tr1/6_containers/unordered/insert/24061-multimap.cc: New.
* testsuite/tr1/6_containers/unordered/insert/24061-multiset.cc: New.
* testsuite/tr1/6_containers/unordered/insert/24061-set.cc: New.
2005-10-08 Kazu Hirata <kazu@codesourcery.com>
Merge from csl-arm-branch:
......
......@@ -59,7 +59,7 @@ namespace tr1
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, true, true>
cache_hash_code, false, true>
{
typedef hashtable <Key, std::pair<const Key, T>,
Alloc,
......@@ -67,7 +67,7 @@ namespace tr1
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, true, true>
cache_hash_code, false, true>
Base;
public:
......@@ -110,7 +110,7 @@ namespace tr1
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, true, false>
cache_hash_code, false, false>
{
typedef hashtable <Key, std::pair<const Key, T>,
Alloc,
......@@ -118,7 +118,7 @@ namespace tr1
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, true, false>
cache_hash_code, false, false>
Base;
public:
......
......@@ -57,14 +57,14 @@ namespace tr1
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, false, true>
cache_hash_code, true, true>
{
typedef hashtable<Value, Value, Alloc,
Internal::identity<Value>, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, false, true>
cache_hash_code, true, true>
Base;
public:
......@@ -106,14 +106,14 @@ namespace tr1
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, false, false>
cache_hash_code, true, false>
{
typedef hashtable<Value, Value, Alloc,
Internal::identity<Value>, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, false, false>
cache_hash_code, true, false>
Base;
public:
......
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.4 Class template unordered_map
#include <tr1/unordered_map>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_map<std::string, int> Map;
typedef Map::iterator iterator;
typedef Map::const_iterator const_iterator;
typedef Map::value_type value_type;
Map m1;
m1.insert(value_type("all the love in the world", 1));
m1.insert(value_type("you know what you are?", 2));
m1.insert(value_type("the collector", 3));
m1.insert(value_type("the hand that feeds", 4));
m1.insert(value_type("love is not enough", 5));
m1.insert(value_type("every day is exactly the same", 6));
m1.insert(value_type("with teeth", 7));
m1.insert(value_type("only", 8));
m1.insert(value_type("getting smaller", 9));
m1.insert(value_type("sunspots", 10));
VERIFY( m1.size() == 10 );
iterator it1 = m1.begin();
++it1;
iterator it2 = it1;
++it2;
iterator it3 = m1.erase(it1);
VERIFY( m1.size() == 9 );
VERIFY( it3 == it2 );
VERIFY( *it3 == *it2 );
iterator it4 = m1.begin();
++it4;
++it4;
++it4;
iterator it5 = it4;
++it5;
++it5;
iterator it6 = m1.erase(it4, it5);
VERIFY( m1.size() == 7 );
VERIFY( it6 == it5 );
VERIFY( *it6 == *it5 );
const_iterator it7 = m1.begin();
++it7;
++it7;
++it7;
const_iterator it8 = it7;
++it8;
const_iterator it9 = m1.erase(it7);
VERIFY( m1.size() == 6 );
VERIFY( it9 == it8 );
VERIFY( *it9 == *it8 );
const_iterator it10 = m1.begin();
++it10;
const_iterator it11 = it10;
++it11;
++it11;
++it11;
++it11;
const_iterator it12 = m1.erase(it10, it11);
VERIFY( m1.size() == 2 );
VERIFY( it12 == it11 );
VERIFY( *it12 == *it11 );
VERIFY( ++it12 == m1.end() );
iterator it13 = m1.erase(m1.begin(), m1.end());
VERIFY( m1.size() == 0 );
VERIFY( it13 == it12 );
VERIFY( it13 == m1.begin() );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.6 Class template unordered_multimap
#include <tr1/unordered_map>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_multimap<std::string, int> Mmap;
typedef Mmap::iterator iterator;
typedef Mmap::const_iterator const_iterator;
typedef Mmap::value_type value_type;
Mmap mm1;
mm1.insert(value_type("all the love in the world", 1));
mm1.insert(value_type("you know what you are?", 2));
mm1.insert(value_type("the collector", 3));
mm1.insert(value_type("the hand that feeds", 4));
mm1.insert(value_type("love is not enough", 5));
mm1.insert(value_type("every day is exactly the same", 6));
mm1.insert(value_type("with teeth", 7));
mm1.insert(value_type("only", 8));
mm1.insert(value_type("getting smaller", 9));
mm1.insert(value_type("sunspots", 10));
mm1.insert(value_type("you know what you are?", 5));
mm1.insert(value_type("the collector", 6));
mm1.insert(value_type("the hand that feeds", 7));
VERIFY( mm1.size() == 13 );
iterator it1 = mm1.begin();
++it1;
iterator it2 = it1;
++it2;
iterator it3 = mm1.erase(it1);
VERIFY( mm1.size() == 12 );
VERIFY( it3 == it2 );
VERIFY( *it3 == *it2 );
iterator it4 = mm1.begin();
++it4;
++it4;
++it4;
iterator it5 = it4;
++it5;
++it5;
iterator it6 = mm1.erase(it4, it5);
VERIFY( mm1.size() == 10 );
VERIFY( it6 == it5 );
VERIFY( *it6 == *it5 );
const_iterator it7 = mm1.begin();
++it7;
++it7;
++it7;
const_iterator it8 = it7;
++it8;
const_iterator it9 = mm1.erase(it7);
VERIFY( mm1.size() == 9 );
VERIFY( it9 == it8 );
VERIFY( *it9 == *it8 );
const_iterator it10 = mm1.begin();
++it10;
const_iterator it11 = it10;
++it11;
++it11;
++it11;
++it11;
const_iterator it12 = mm1.erase(it10, it11);
VERIFY( mm1.size() == 5 );
VERIFY( it12 == it11 );
VERIFY( *it12 == *it11 );
iterator it13 = mm1.erase(mm1.begin(), mm1.end());
VERIFY( mm1.size() == 0 );
VERIFY( it13 == mm1.end() );
VERIFY( it13 == mm1.begin() );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.5 Class template unordered_multiset
#include <tr1/unordered_set>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_multiset<std::string> Mset;
typedef Mset::iterator iterator;
typedef Mset::const_iterator const_iterator;
Mset ms1;
ms1.insert("all the love in the world");
ms1.insert("you know what you are?");
ms1.insert("the collector");
ms1.insert("the hand that feeds");
ms1.insert("love is not enough");
ms1.insert("every day is exactly the same");
ms1.insert("with teeth");
ms1.insert("only");
ms1.insert("getting smaller");
ms1.insert("sunspots");
ms1.insert("the hand that feeds");
ms1.insert("love is not enough");
ms1.insert("every day is exactly the same");
VERIFY( ms1.size() == 13 );
iterator it1 = ms1.begin();
++it1;
iterator it2 = it1;
++it2;
iterator it3 = ms1.erase(it1);
VERIFY( ms1.size() == 12 );
VERIFY( it3 == it2 );
VERIFY( *it3 == *it2 );
iterator it4 = ms1.begin();
++it4;
++it4;
++it4;
iterator it5 = it4;
++it5;
++it5;
iterator it6 = ms1.erase(it4, it5);
VERIFY( ms1.size() == 10 );
VERIFY( it6 == it5 );
VERIFY( *it6 == *it5 );
const_iterator it7 = ms1.begin();
++it7;
++it7;
++it7;
const_iterator it8 = it7;
++it8;
const_iterator it9 = ms1.erase(it7);
VERIFY( ms1.size() == 9 );
VERIFY( it9 == it8 );
VERIFY( *it9 == *it8 );
const_iterator it10 = ms1.begin();
++it10;
const_iterator it11 = it10;
++it11;
++it11;
++it11;
++it11;
const_iterator it12 = ms1.erase(it10, it11);
VERIFY( ms1.size() == 5 );
VERIFY( it12 == it11 );
VERIFY( *it12 == *it11 );
iterator it13 = ms1.erase(ms1.begin(), ms1.end());
VERIFY( ms1.size() == 0 );
VERIFY( it13 == ms1.end() );
VERIFY( it13 == ms1.begin() );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.3 Class template unordered_set
#include <tr1/unordered_set>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_set<std::string> Set;
typedef Set::iterator iterator;
typedef Set::const_iterator const_iterator;
Set s1;
s1.insert("all the love in the world");
s1.insert("you know what you are?");
s1.insert("the collector");
s1.insert("the hand that feeds");
s1.insert("love is not enough");
s1.insert("every day is exactly the same");
s1.insert("with teeth");
s1.insert("only");
s1.insert("getting smaller");
s1.insert("sunspots");
VERIFY( s1.size() == 10 );
iterator it1 = s1.begin();
++it1;
iterator it2 = it1;
++it2;
iterator it3 = s1.erase(it1);
VERIFY( s1.size() == 9 );
VERIFY( it3 == it2 );
VERIFY( *it3 == *it2 );
iterator it4 = s1.begin();
++it4;
++it4;
++it4;
iterator it5 = it4;
++it5;
++it5;
iterator it6 = s1.erase(it4, it5);
VERIFY( s1.size() == 7 );
VERIFY( it6 == it5 );
VERIFY( *it6 == *it5 );
const_iterator it7 = s1.begin();
++it7;
++it7;
++it7;
const_iterator it8 = it7;
++it8;
const_iterator it9 = s1.erase(it7);
VERIFY( s1.size() == 6 );
VERIFY( it9 == it8 );
VERIFY( *it9 == *it8 );
const_iterator it10 = s1.begin();
++it10;
const_iterator it11 = it10;
++it11;
++it11;
++it11;
++it11;
const_iterator it12 = s1.erase(it10, it11);
VERIFY( s1.size() == 2 );
VERIFY( it12 == it11 );
VERIFY( *it12 == *it11 );
VERIFY( ++it12 == s1.end() );
iterator it13 = s1.erase(s1.begin(), s1.end());
VERIFY( s1.size() == 0 );
VERIFY( it13 == s1.end() );
VERIFY( it13 == s1.begin() );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.4 Class template unordered_map
#include <tr1/unordered_map>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_map<std::string, int> Map;
typedef Map::iterator iterator;
typedef Map::const_iterator const_iterator;
typedef Map::value_type value_type;
Map m1;
iterator it1 = m1.insert(m1.begin(),
value_type("all the love in the world", 1));
VERIFY( m1.size() == 1 );
VERIFY( *it1 == value_type("all the love in the world", 1) );
const_iterator cit1(it1);
const_iterator cit2 = m1.insert(cit1,
value_type("you know what you are?", 2));
VERIFY( m1.size() == 2 );
VERIFY( cit2 != cit1 );
VERIFY( *cit2 == value_type("you know what you are?", 2) );
iterator it2 = m1.insert(it1, value_type("all the love in the world", 3));
VERIFY( m1.size() == 2 );
VERIFY( it2 == it1 );
VERIFY( *it2 == value_type("all the love in the world", 1) );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.6 Class template unordered_multimap
#include <tr1/unordered_map>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_multimap<std::string, int> Mmap;
typedef Mmap::iterator iterator;
typedef Mmap::const_iterator const_iterator;
typedef Mmap::value_type value_type;
Mmap mm1;
iterator it1 = mm1.insert(mm1.begin(),
value_type("all the love in the world", 1));
VERIFY( mm1.size() == 1 );
VERIFY( *it1 == value_type("all the love in the world", 1) );
const_iterator cit1(it1);
const_iterator cit2 = mm1.insert(cit1,
value_type("you know what you are?", 2));
VERIFY( mm1.size() == 2 );
VERIFY( cit2 != cit1 );
VERIFY( *cit2 == value_type("you know what you are?", 2) );
iterator it2 = mm1.insert(it1, value_type("all the love in the world", 3));
VERIFY( mm1.size() == 3 );
VERIFY( it2 != it1 );
VERIFY( *it2 == value_type("all the love in the world", 3) );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.5 Class template unordered_multiset
#include <tr1/unordered_set>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_multiset<std::string> Mset;
typedef Mset::iterator iterator;
typedef Mset::const_iterator const_iterator;
Mset ms1;
iterator it1 = ms1.insert(ms1.begin(), "all the love in the world");
VERIFY( ms1.size() == 1 );
VERIFY( *it1 == "all the love in the world" );
const_iterator cit1(it1);
const_iterator cit2 = ms1.insert(cit1, "you know what you are?");
VERIFY( ms1.size() == 2 );
VERIFY( cit2 != cit1 );
VERIFY( *cit2 == "you know what you are?" );
iterator it2 = ms1.insert(it1, "all the love in the world");
VERIFY( ms1.size() == 3 );
VERIFY( it2 != it1 );
VERIFY( *it2 == "all the love in the world" );
}
int main()
{
test01();
return 0;
}
// 2005-10-08 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 2005 Free Software Foundation, Inc.
//
// 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 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 6.3.4.3 Class template unordered_set
#include <tr1/unordered_set>
#include <string>
#include <testsuite_hooks.h>
// libstdc++/24061
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::tr1::unordered_set<std::string> Set;
typedef Set::iterator iterator;
typedef Set::const_iterator const_iterator;
Set s1;
iterator it1 = s1.insert(s1.begin(), "all the love in the world");
VERIFY( s1.size() == 1 );
VERIFY( *it1 == "all the love in the world" );
const_iterator cit1(it1);
const_iterator cit2 = s1.insert(cit1, "you know what you are?");
VERIFY( s1.size() == 2 );
VERIFY( cit2 != cit1 );
VERIFY( *cit2 == "you know what you are?" );
iterator it2 = s1.insert(it1, "all the love in the world");
VERIFY( s1.size() == 2 );
VERIFY( it2 == it1 );
VERIFY( *it2 == "all the love in the world" );
}
int main()
{
test01();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment