diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-27 19:26:31 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-27 19:26:31 +0000 |
commit | 04590b81a7ced69de6906616ce002d2608e77e90 (patch) | |
tree | b6e20afb5d6dba858e44922286386564bc53d0f8 /utils/value_array.h | |
parent | 649a4ea65e78193876d7cb5f387ef775362bfea0 (diff) |
compiles
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@626 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/value_array.h')
-rwxr-xr-x | utils/value_array.h | 24 |
1 files changed, 24 insertions, 0 deletions
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<T,A> const& v1, ValueArray<T,A> const& v2) std::equal(v1.begin(),v1.end(),v2.begin()); } +template <class A> +bool operator==(ValueArray<char,A> const& v1, ValueArray<char,A> const& v2) +{ + typename ValueArray<char,A>::size_type sz=v1.size(); + return sz == v2.size() && + 0==std::memcmp(v1.begin(),v2.begin(),sizeof(char)*sz); +} + +template <class A> +bool operator==(ValueArray<unsigned char,A> const& v1, ValueArray<unsigned char,A> const& v2) +{ + typename ValueArray<char,A>::size_type sz=v1.size(); + return sz == v2.size() && + 0==std::memcmp(v1.begin(),v2.begin(),sizeof(char)*sz); +} template <class T,class A> bool operator< (ValueArray<T,A> const& v1, ValueArray<T,A> const& v2) @@ -315,6 +330,15 @@ bool operator< (ValueArray<T,A> const& v1, ValueArray<T,A> const& v2) , v2.end() ); } +template <class A> +bool operator<(ValueArray<unsigned char,A> const& v1, ValueArray<unsigned char,A> const& v2) +{ + typename ValueArray<char,A>::size_type sz=v1.size(); + return sz == v2.size() && + std::memcmp(v1.begin(),v2.begin(),sizeof(char)*sz)<0; +} + + template <class T,class A> void memcpy(void *out,ValueArray<T,A> const& v) { std::memcpy(out,v.begin(),v.size()*sizeof(T)); |