summaryrefslogtreecommitdiff
path: root/utils/small_vector.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-13 08:28:58 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-13 08:28:58 +0000
commitcf54677dac448084f38cf54d2596a2078492fce6 (patch)
tree4924c470857ecb493b07ee3123435abce8b9bdf2 /utils/small_vector.h
parentead8845217c5e6e48f3680ead6f859ec8e110eb2 (diff)
boost::hash
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@540 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/small_vector.h')
-rw-r--r--utils/small_vector.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/small_vector.h b/utils/small_vector.h
index 8c1c3bfe..f1e53a51 100644
--- a/utils/small_vector.h
+++ b/utils/small_vector.h
@@ -252,13 +252,12 @@ public:
swap_pod(*this,o);
}
- inline std::size_t hash() const {
- using namespace boost;
+ inline std::size_t hash_impl() const {
if (size_==0) return 0;
- if (size_==1) return hash_value(data_.vals[0]);
+// if (size_==1) return boost::hash_value(data_.vals[0]);
if (size<= SV_MAX)
- return hash_range(data_.vals,data_.vals+size_);
- return hash_range(data_.ptr,data_.ptr+size_);
+ return boost::hash_range(data_.vals,data_.vals+size_);
+ return boost::hash_range(data_.ptr,data_.ptr+size_);
}
private:
@@ -271,9 +270,13 @@ public:
uint16_t capacity_; // only defined when size_ > __SV_MAX_STATIC
};
+namespace boost {
+// shouldn't need to nest this, but getting into trouble with tr1::hash linkage
+}
+
template <class T,int M>
-std::size_t hash_value(SmallVector<T,M> const& x) {
- return x.hash();
+inline std::size_t hash_value(SmallVector<T,M> const& x) {
+ return x.hash_impl();
}
template <class T,int M>