diff --git a/Doc/changelog.docu b/Doc/changelog.docu index 947aba94..53550022 100644 --- a/Doc/changelog.docu +++ b/Doc/changelog.docu @@ -19,6 +19,12 @@
  • Fixed mingw compilataion error
  • +General + + + 6.1 (2016/05/31) diff --git a/src/OpenMesh/Core/Mesh/Handles.hh b/src/OpenMesh/Core/Mesh/Handles.hh index 1488ce09..94c11b70 100644 --- a/src/OpenMesh/Core/Mesh/Handles.hh +++ b/src/OpenMesh/Core/Mesh/Handles.hh @@ -106,6 +106,8 @@ private: int idx_; }; +// this is used by boost::unordered_set/map +inline size_t hash_value(const BaseHandle& h) { return h.idx(); } //----------------------------------------------------------------------------- @@ -150,5 +152,79 @@ struct FaceHandle : public BaseHandle //============================================================================= } // namespace OpenMesh //============================================================================= + +#ifdef OM_HAS_HASH +#include +namespace std { + +#if defined(_MSVC_VER) +# pragma warning(push) +# pragma warning(disable:4099) // For VC++ it is class hash +#endif + + +template <> +class hash + : public std::unary_function +{ + + std::size_t operator()(const OpenMesh::BaseHandle& h) const + { + return h.idx(); + } +}; + +template <> +struct hash + : public std::unary_function +{ + + std::size_t operator()(const OpenMesh::VertexHandle& h) const + { + return h.idx(); + } +}; + +template <> +struct hash + : public std::unary_function +{ + + std::size_t operator()(const OpenMesh::HalfedgeHandle& h) const + { + return h.idx(); + } +}; + +template <> +struct hash + : public std::unary_function +{ + + std::size_t operator()(const OpenMesh::EdgeHandle& h) const + { + return h.idx(); + } +}; + +template <> +struct hash + : public std::unary_function +{ + + std::size_t operator()(const OpenMesh::FaceHandle& h) const + { + return h.idx(); + } +}; + +#if defined(_MSVC_VER) +# pragma warning(pop) +#endif + +} +#endif // OM_HAS_HASH + + #endif // OPENMESH_HANDLES_HH //============================================================================= diff --git a/src/OpenMesh/Core/Mesh/PolyMeshT.hh b/src/OpenMesh/Core/Mesh/PolyMeshT.hh index 04e87def..d0e4d4f8 100644 --- a/src/OpenMesh/Core/Mesh/PolyMeshT.hh +++ b/src/OpenMesh/Core/Mesh/PolyMeshT.hh @@ -608,7 +608,6 @@ const LHS mesh_cast(const PolyMeshT *rhs) { return MeshCast*>::cast(rhs); } - //============================================================================= } // namespace OpenMesh //============================================================================= diff --git a/src/OpenMesh/Core/System/config.h b/src/OpenMesh/Core/System/config.h index b85d9719..31537b5e 100644 --- a/src/OpenMesh/Core/System/config.h +++ b/src/OpenMesh/Core/System/config.h @@ -101,6 +101,11 @@ #endif typedef unsigned int uint; + +#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) +#define OM_HAS_HASH +#endif + //============================================================================= #endif // OPENMESH_CONFIG_H defined //=============================================================================