diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h index d1b13b8e804..c7df575f8ae 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h @@ -20,6 +20,9 @@ #include #include +#include +#include + namespace CGAL { class Periodic_3_offset_3 @@ -43,18 +46,27 @@ public: int& z() { return _offz; } int z() const { return _offz; } - int &operator[](int i) { + // Use sfinae on the operator[] to accept only integral types as argument + template ::value>::type* = nullptr> + int& operator[](T i) + { if (i==0) return _offx; if (i==1) return _offy; CGAL_assertion(i==2); return _offz; } - int operator[](int i) const { + + template ::value>::type* = nullptr> + int operator[](T i) const + { if (i==0) return _offx; if (i==1) return _offy; CGAL_assertion(i==2); return _offz; } + void operator+=(const Periodic_3_offset_3 &other) { _offx += other._offx; _offy += other._offy;