diff --git a/CGAL_Core/include/CGAL/CORE/extLong.h b/CGAL_Core/include/CGAL/CORE/extLong.h index 095c5105b8d..1447842b61e 100644 --- a/CGAL_Core/include/CGAL/CORE/extLong.h +++ b/CGAL_Core/include/CGAL/CORE/extLong.h @@ -31,6 +31,9 @@ #include #include +#include +#include + namespace CORE { #ifndef LONG_MAX @@ -77,6 +80,9 @@ public: extLong(long); /// constructor for \c unsigned long extLong(unsigned long); + /// constructor for \c std::size_t + template>> + extLong(std::size_t s); //@} /// \name Arithmetic and assignment operators @@ -188,6 +194,17 @@ inline extLong::extLong(unsigned long u) { } } +template +inline extLong::extLong(std::size_t u) { + if (u >= (std::numeric_limits::max)()) { + val = EXTLONG_MAX; + flag = 1; + } else { + val = static_cast(u); + flag = 0; + } +} + // isNaN defaults to false inline extLong::extLong(bool isNaN) : val(0), flag(0) { if (isNaN) {