[llvm-commits] CVS: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 6 20:09:01 PDT 2003
Changes in directory llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++:
spellcheck.cpp updated: 1.1 -> 1.2
---
Log message:
Ugh, this uses a wierd implementation of hash_map, which is not standardized
I don't want to even THINK About autoconfing this test, so switch it to use
<map>
---
Diffs of the changes: (+4 -27)
Index: llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp
diff -u llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.1 llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.2
--- llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp:1.1 Mon Oct 6 20:06:50 2003
+++ llvm/test/Programs/SingleSource/Benchmarks/Shootout-C++/spellcheck.cpp Mon Oct 6 20:08:48 2003
@@ -1,42 +1,19 @@
// -*- mode: c++ -*-
-// $Id: spellcheck.cpp,v 1.1 2003/10/07 01:06:50 lattner Exp $
+// $Id: spellcheck.cpp,v 1.2 2003/10/07 01:08:48 lattner Exp $
// http://www.bagley.org/~doug/shootout/
// STL spell checker from Bill Lear
#include <iostream>
#include <utility>
#include <fstream>
-#include <hash_map.h>
#include <algorithm>
#include <iomanip>
+#include <map>
using namespace std;
typedef std::pair<const char*, const char*> span;
-namespace std {
- template <> struct hash<span>;
- template <> struct equal_to<span>;
-}
-
-template<> struct hash<span> {
- inline size_t operator()(const span& s) const {
- size_t h = 0;
- const char* end = s.second;
- for (const char* begin = s.first; begin != end; ++begin) {
- h = 5 * h + *begin;
- }
- return h;
- }
-};
-
-template<> struct equal_to<span> {
- inline bool operator()(const span& s1, const span& s2) const {
- return (s1.second - s1.first) == (s2.second - s2.first) &&
- std::equal(s1.first, s1.second, s2.first);
- }
-};
-
class spell_checker {
public:
spell_checker() {
@@ -64,7 +41,7 @@
}
private:
- std::hash_map<span, int> dict;
+ std::map<span, int> dict;
};
int main() {
More information about the llvm-commits
mailing list