Converters now simply forward fundamental types, forbid others

This commit is contained in:
Mael Rouxel-Labbé 2021-12-03 16:48:51 +01:00
parent 5aa34c9106
commit 71cbd212dc
3 changed files with 37 additions and 24 deletions

View File

@ -127,14 +127,20 @@ public:
}
template <typename T>
typename K2::FT
operator()(const T&,
T
operator()(const T t,
typename std::enable_if<std::is_fundamental<T>::value>::type* = nullptr) const
{
// Disable fundamental types (other than K1::FT) to avoid unexpected results
// More details: https://github.com/CGAL/cgal/issues/4982
CGAL_static_assertion(!(std::is_fundamental<T>::value));
return typename K2::FT();
return t;
}
template <typename T>
T
operator()(const T t,
typename std::enable_if<!std::is_fundamental<T>::value>::type* = nullptr) const
{
CGAL_static_assertion(!(std::is_same<T, T>::value));
return t;
}
// drop the boost::detail::variant::void_ generated by the macros

View File

@ -87,14 +87,20 @@ public:
}
template <typename T>
typename K2::FT
operator()(const T&,
typename std::enable_if<std::is_fundamental<T>::value>::type* = nullptr)
T
operator()(const T t,
typename std::enable_if<std::is_fundamental<T>::value>::type* = nullptr) const
{
// Disable fundamental types (other than K1::FT) to avoid unexpected results
// More details: https://github.com/CGAL/cgal/issues/4982
CGAL_static_assertion(!(std::is_fundamental<T>::value));
return typename K2::FT();
return t;
}
template <typename T>
T
operator()(const T t,
typename std::enable_if<!std::is_fundamental<T>::value>::type* = nullptr) const
{
CGAL_static_assertion(!(std::is_same<T, T>::value));
return t;
}
typename K2::Point_2

View File

@ -100,14 +100,20 @@ public:
}
template <typename T>
typename K2::FT
operator()(const T&,
T
operator()(const T t,
typename std::enable_if<std::is_fundamental<T>::value>::type* = nullptr) const
{
// Disable fundamental types (other than K1::FT) to avoid unexpected results
// More details: https://github.com/CGAL/cgal/issues/4982
CGAL_static_assertion(!(std::is_fundamental<T>::value));
return typename K2::FT();
return t;
}
template <typename T>
T
operator()(const T t,
typename std::enable_if<!std::is_fundamental<T>::value>::type* = nullptr) const
{
CGAL_static_assertion(!(std::is_same<T, T>::value));
return t;
}
std::vector<Object>
@ -121,11 +127,6 @@ public:
return res;
}
int operator()(const int &a)
{
return a;
}
typename K2::Point_d
operator()(const typename K1::Point_d &a) const
{