Trivial
This commit is contained in:
parent
c41b6d80b6
commit
98842dca74
@ -43,18 +43,13 @@ inline size_t hash_combine (size_t seed, const T& v)
|
|||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
template <typename T1, typename T2> struct hash<std::pair<T1,T2>>
|
template <typename T1, typename T2> struct hash<std::pair<T1,T2>> {
|
||||||
{
|
size_t operator() (const std::pair<T1,T2>& p) const {
|
||||||
size_t operator() (const std::pair<T1,T2>& p) const
|
|
||||||
{
|
|
||||||
return horus::hash_combine (std::hash<T1>()(p.first), p.second);
|
return horus::hash_combine (std::hash<T1>()(p.first), p.second);
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T> struct hash<std::vector<T>>
|
template <typename T> struct hash<std::vector<T>> {
|
||||||
{
|
size_t operator() (const std::vector<T>& vec) const {
|
||||||
size_t operator() (const std::vector<T>& vec) const
|
|
||||||
{
|
|
||||||
size_t h = 0;
|
size_t h = 0;
|
||||||
typename std::vector<T>::const_iterator first = vec.begin();
|
typename std::vector<T>::const_iterator first = vec.begin();
|
||||||
typename std::vector<T>::const_iterator last = vec.end();
|
typename std::vector<T>::const_iterator last = vec.end();
|
||||||
@ -62,8 +57,7 @@ template <typename T> struct hash<std::vector<T>>
|
|||||||
h = horus::hash_combine (h, *first);
|
h = horus::hash_combine (h, *first);
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
|
@ -77,14 +77,12 @@ namespace std {
|
|||||||
template <> struct hash<horus::Symbol> {
|
template <> struct hash<horus::Symbol> {
|
||||||
size_t operator() (const horus::Symbol& s) const {
|
size_t operator() (const horus::Symbol& s) const {
|
||||||
return std::hash<unsigned>() (s);
|
return std::hash<unsigned>() (s);
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct hash<horus::LogVar> {
|
template <> struct hash<horus::LogVar> {
|
||||||
size_t operator() (const horus::LogVar& X) const {
|
size_t operator() (const horus::LogVar& X) const {
|
||||||
return std::hash<unsigned>() (X);
|
return std::hash<unsigned>() (X);
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
|
@ -402,35 +402,26 @@ operator<< (std::ostream& os, const std::vector<T>& v)
|
|||||||
namespace func_obj {
|
namespace func_obj {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct max : public std::binary_function<T, T, T>
|
struct max : public std::binary_function<T, T, T> {
|
||||||
{
|
T operator() (const T& x, const T& y) const {
|
||||||
T operator() (const T& x, const T& y) const
|
|
||||||
{
|
|
||||||
return x < y ? y : x;
|
return x < y ? y : x;
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct abs_diff : public std::binary_function<T, T, T>
|
struct abs_diff : public std::binary_function<T, T, T> {
|
||||||
{
|
T operator() (const T& x, const T& y) const {
|
||||||
T operator() (const T& x, const T& y) const
|
|
||||||
{
|
|
||||||
return std::abs (x - y);
|
return std::abs (x - y);
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct abs_diff_exp : public std::binary_function<T, T, T>
|
struct abs_diff_exp : public std::binary_function<T, T, T> {
|
||||||
{
|
T operator() (const T& x, const T& y) const {
|
||||||
T operator() (const T& x, const T& y) const
|
|
||||||
{
|
|
||||||
return std::abs (std::exp (x) - std::exp (y));
|
return std::abs (std::exp (x) - std::exp (y));
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace func_obj
|
} // namespace func_obj
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user