summaryrefslogtreecommitdiff
path: root/klm/util/string_piece.hh
diff options
context:
space:
mode:
authorAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
committerAvneesh Saluja <asaluja@gmail.com>2013-03-28 18:28:16 -0700
commit3d8d656fa7911524e0e6885647173474524e0784 (patch)
tree81b1ee2fcb67980376d03f0aa48e42e53abff222 /klm/util/string_piece.hh
parentbe7f57fdd484e063775d7abf083b9fa4c403b610 (diff)
parent96fedabebafe7a38a6d5928be8fff767e411d705 (diff)
fixed conflicts
Diffstat (limited to 'klm/util/string_piece.hh')
-rw-r--r--klm/util/string_piece.hh36
1 files changed, 4 insertions, 32 deletions
diff --git a/klm/util/string_piece.hh b/klm/util/string_piece.hh
index be6a643d..9cf4c7f6 100644
--- a/klm/util/string_piece.hh
+++ b/klm/util/string_piece.hh
@@ -1,6 +1,6 @@
/* If you use ICU in your program, then compile with -DHAVE_ICU -licui18n. If
* you don't use ICU, then this will use the Google implementation from Chrome.
- * This has been modified from the original version to let you choose.
+ * This has been modified from the original version to let you choose.
*/
// Copyright 2008, Google Inc.
@@ -50,10 +50,6 @@
#include "util/have.hh"
-#ifdef HAVE_BOOST
-#include <boost/functional/hash/hash.hpp>
-#endif // HAVE_BOOST
-
#include <cstring>
#include <iosfwd>
#include <ostream>
@@ -62,9 +58,9 @@
#include <unicode/stringpiece.h>
#include <unicode/uversion.h>
-// Old versions of ICU don't define operator== and operator!=.
+// Old versions of ICU don't define operator== and operator!=.
#if (U_ICU_VERSION_MAJOR_NUM < 4) || ((U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM < 4))
-#warning You are using an old version of ICU. Consider upgrading to ICU >= 4.6.
+#warning You are using an old version of ICU. Consider upgrading to ICU >= 4.6.
inline bool operator==(const StringPiece& x, const StringPiece& y) {
if (x.size() != y.size())
return false;
@@ -256,33 +252,9 @@ inline std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
return o.write(piece.data(), static_cast<std::streamsize>(piece.size()));
}
-#ifdef HAVE_BOOST
-inline size_t hash_value(const StringPiece &str) {
- return boost::hash_range(str.data(), str.data() + str.length());
-}
-
-/* Support for lookup of StringPiece in boost::unordered_map<std::string> */
-struct StringPieceCompatibleHash : public std::unary_function<const StringPiece &, size_t> {
- size_t operator()(const StringPiece &str) const {
- return hash_value(str);
- }
-};
-
-struct StringPieceCompatibleEquals : public std::binary_function<const StringPiece &, const std::string &, bool> {
- bool operator()(const StringPiece &first, const StringPiece &second) const {
- return first == second;
- }
-};
-template <class T> typename T::const_iterator FindStringPiece(const T &t, const StringPiece &key) {
- return t.find(key, StringPieceCompatibleHash(), StringPieceCompatibleEquals());
-}
-template <class T> typename T::iterator FindStringPiece(T &t, const StringPiece &key) {
- return t.find(key, StringPieceCompatibleHash(), StringPieceCompatibleEquals());
-}
-#endif
-
#ifdef HAVE_ICU
U_NAMESPACE_END
+using U_NAMESPACE_QUALIFIER StringPiece;
#endif
#endif // BASE_STRING_PIECE_H__