...
 
Commits (1)
......@@ -46,6 +46,9 @@
#include <algorithm>
#include <iosfwd>
#include <vector>
#include <limits>
#include <cassert>
#include <type_traits>
#include "../System/FunctionalInclude.hh"
#include "../System/Deprecation.hh"
......@@ -55,8 +58,11 @@ namespace OpenVolumeMesh {
// Define handle types in order to distinguish different entities by their indices
class OpenVolumeMeshHandle {
public:
// Default constructor
explicit OpenVolumeMeshHandle(int _idx) : idx_(_idx) {};
template<typename T=int,
typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
explicit OpenVolumeMeshHandle(T _idx = -1)
: idx_(static_cast<int>(_idx))
{ assert(_idx <= std::numeric_limits<int>::max()); }
OpenVolumeMeshHandle& operator=(int _idx) {
idx_ = _idx;
......@@ -97,12 +103,12 @@ private:
// Default entity handles
class VertexHandle : public OpenVolumeMeshHandle { public: explicit VertexHandle(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
class EdgeHandle : public OpenVolumeMeshHandle { public: explicit EdgeHandle(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
class FaceHandle : public OpenVolumeMeshHandle { public: explicit FaceHandle(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
class CellHandle : public OpenVolumeMeshHandle { public: explicit CellHandle(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
class HalfEdgeHandle : public OpenVolumeMeshHandle { public: explicit HalfEdgeHandle(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
class HalfFaceHandle : public OpenVolumeMeshHandle { public: explicit HalfFaceHandle(int _idx = -1) : OpenVolumeMeshHandle(_idx) {} };
class VertexHandle : public OpenVolumeMeshHandle { public: using OpenVolumeMeshHandle::OpenVolumeMeshHandle; };
class EdgeHandle : public OpenVolumeMeshHandle { public: using OpenVolumeMeshHandle::OpenVolumeMeshHandle; };
class FaceHandle : public OpenVolumeMeshHandle { public: using OpenVolumeMeshHandle::OpenVolumeMeshHandle; };
class CellHandle : public OpenVolumeMeshHandle { public: using OpenVolumeMeshHandle::OpenVolumeMeshHandle; };
class HalfEdgeHandle : public OpenVolumeMeshHandle { public: using OpenVolumeMeshHandle::OpenVolumeMeshHandle; };
class HalfFaceHandle : public OpenVolumeMeshHandle { public: using OpenVolumeMeshHandle::OpenVolumeMeshHandle; };
// Helper class that is used to decrease all handles
// exceeding a certain threshold
......