From 1eab70e16f0e0d5531f3babfea2062c82f6362e1 Mon Sep 17 00:00:00 2001 From: graehl Date: Fri, 27 Aug 2010 19:26:31 +0000 Subject: compiles git-svn-id: https://ws10smt.googlecode.com/svn/trunk@626 ec762483-ff6d-05da-a07a-a48fb63a330f --- utils/value_array.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'utils/value_array.h') diff --git a/utils/value_array.h b/utils/value_array.h index a10f754f..f1cc2a84 100755 --- a/utils/value_array.h +++ b/utils/value_array.h @@ -305,6 +305,21 @@ bool operator==(ValueArray const& v1, ValueArray const& v2) std::equal(v1.begin(),v1.end(),v2.begin()); } +template +bool operator==(ValueArray const& v1, ValueArray const& v2) +{ + typename ValueArray::size_type sz=v1.size(); + return sz == v2.size() && + 0==std::memcmp(v1.begin(),v2.begin(),sizeof(char)*sz); +} + +template +bool operator==(ValueArray const& v1, ValueArray const& v2) +{ + typename ValueArray::size_type sz=v1.size(); + return sz == v2.size() && + 0==std::memcmp(v1.begin(),v2.begin(),sizeof(char)*sz); +} template bool operator< (ValueArray const& v1, ValueArray const& v2) @@ -315,6 +330,15 @@ bool operator< (ValueArray const& v1, ValueArray const& v2) , v2.end() ); } +template +bool operator<(ValueArray const& v1, ValueArray const& v2) +{ + typename ValueArray::size_type sz=v1.size(); + return sz == v2.size() && + std::memcmp(v1.begin(),v2.begin(),sizeof(char)*sz)<0; +} + + template void memcpy(void *out,ValueArray const& v) { std::memcpy(out,v.begin(),v.size()*sizeof(T)); -- cgit v1.2.3