File indexing completed on 2025-01-18 09:37:34
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_GRAPH_NUMERIC_VALUES_HPP
0008 #define BOOST_GRAPH_NUMERIC_VALUES_HPP
0009
0010 #include <limits>
0011
0012 namespace boost
0013 {
0014
0015 #define BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(type) \
0016 template <> struct numeric_values< type > \
0017 { \
0018 typedef type value_type; \
0019 static type zero() { return 0.0; } \
0020 static type infinity() \
0021 { \
0022 return std::numeric_limits< type >::infinity(); \
0023 } \
0024 };
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 template < typename T > struct numeric_values
0036 {
0037 typedef T value_type;
0038
0039 static T zero() { return T(); }
0040
0041 static T infinity() { return (std::numeric_limits< T >::max)(); }
0042 };
0043
0044
0045
0046 BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(float)
0047 BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(double)
0048 BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(long double)
0049
0050 #undef BOOST_GRAPH_SPECIALIZE_NUMERIC_VALUE
0051 }
0052
0053 #endif