00001 #ifndef boost_numeric_bindings_traits_algorithm_hpp 00002 #define boost_numeric_bindings_traits_algorithm_hpp 00003 00004 #include <boost/numeric/bindings/traits/type_traits.hpp> 00005 00006 namespace boost { namespace numeric { namespace bindings { namespace traits { 00007 00012 00013 template < typename T > 00014 struct is_equal 00015 { 00016 is_equal(typename type_traits< T >::real_type tolerance) : tolerance_( tolerance ) {} 00017 00018 bool operator()(const T& a, const T& b) 00019 { return std::abs( a - b ) < tolerance_ ; } 00020 00021 // bool operator()(const T& a, const T& b, typename value_traits< T >::value_type tolerance) 00022 // { return std::abs( a - b ) < tolerance ; } 00023 00024 typename type_traits< T >::real_type tolerance_ ; 00025 } ; 00026 00027 }}}} 00028 00029 #endif // boost_numeric_bindings_traits_algorithm_hpp