and.hxx
Go to the documentation of this file.00001 #pragma once
00002 #ifndef OPENGM_OPERATION_AND_HXX
00003 #define OPENGM_OPERATION_AND_HXX
00004
00005 namespace opengm {
00006
00010 struct And
00011 {
00013 template<class T>
00014 static T neutral()
00015 { return static_cast<T>(true); }
00016
00018 template<class T>
00019 static void neutral(T& out)
00020 { out = static_cast<T>(true); }
00021
00023 template<class T1, class T2>
00024 static void op(const T1& in, T2& out)
00025 { out &= in; }
00026
00028 template<class T1,class T2,class T3>
00029 static void op(const T1& in1, const T2& in2, T3& out)
00030 { out = in1 & in2; }
00031 static void op(const bool& in1, const bool& in2, bool& out)
00032 { out = in1 && in2; }
00033
00035 static bool hasbop()
00036 { return true; }
00037
00039 template<class T>
00040 static bool bop(const T& in1, const T& in2)
00041 { return (in1 & in2); }
00042 static bool bop(const bool& in1, const bool& in2)
00043 { return (in1 && in2); }
00044
00046 template<class T>
00047 static bool ibop(const T& in1, const T& in2)
00048 { return !(in1 & in2); }
00049 static bool ibop(const bool& in1, const bool& in2)
00050 { return !(in1 && in2); }
00051 };
00052
00053 }
00054
00055 #endif // #ifndef OPENGM_OPERATION_AND_HXX