2012-08-29 01:16:12 +09:00
|
|
|
#ifndef SPROUT_RATIONAL_HASH_HPP
|
|
|
|
#define SPROUT_RATIONAL_HASH_HPP
|
|
|
|
|
|
|
|
#include <cstddef>
|
2013-02-19 02:49:10 +09:00
|
|
|
#include <functional>
|
2012-08-29 01:16:12 +09:00
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/rational/rational.hpp>
|
2013-02-04 18:42:39 +09:00
|
|
|
#include <sprout/functional/hash.hpp>
|
2012-08-29 01:16:12 +09:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// hash_value
|
|
|
|
//
|
|
|
|
template<typename T>
|
2012-10-06 00:58:56 +09:00
|
|
|
inline SPROUT_CONSTEXPR std::size_t
|
|
|
|
hash_value(sprout::rational<T> const& v) {
|
2012-08-29 01:16:12 +09:00
|
|
|
return sprout::hash_values(v.numerator(), v.denominator());
|
|
|
|
}
|
2013-03-22 14:24:19 +09:00
|
|
|
} // namespace sprout
|
2012-08-29 01:16:12 +09:00
|
|
|
|
2013-02-07 03:11:17 +09:00
|
|
|
namespace std {
|
|
|
|
//
|
|
|
|
// hash
|
|
|
|
//
|
|
|
|
template<typename T>
|
|
|
|
struct hash<sprout::rational<T> >
|
|
|
|
: public sprout::hash<sprout::rational<T> >
|
|
|
|
{};
|
|
|
|
} // namespace std
|
|
|
|
|
2012-09-21 15:43:30 +09:00
|
|
|
#endif // SPROUT_RATIONAL_HASH_HPP
|