#ifndef HASHFUNCTIONS_H
#define HASHFUNCTIONS_H

#include <QGeoCoordinate>
#include <functional>

#include <QmlObjectListModel.h>

namespace std {

template <> struct hash<QGeoCoordinate> {
  std::size_t operator()(const QGeoCoordinate &c) {
    hash<double> h;
    return h(c.latitude()) ^ (h(c.longitude()) << 1) ^ (h(c.altitude()) << 2);
  }
};

template <template <class> class Container, class EntryType>
struct hash<Container<EntryType>> {
  std::size_t operator()(const Container<EntryType> &list) {
    std::size_t value = 0;
    hash<EntryType> h;
    for (const auto it = std::begin(list); it != std::end(list); ++it) {
      value ^= h(*it);
    }

    return value;
  }
};
} // namespace std

#endif // HASHFUNCTIONS_H
