check if Kernel provides the nested type

This commit is contained in:
Sébastien Loriot 2024-06-19 11:21:44 +02:00
parent e5a07965ce
commit 9e2f375d10
2 changed files with 32 additions and 5 deletions

View File

@ -21,6 +21,7 @@
#include <CGAL/Interval_nt.h>
#include <CGAL/Kernel/Type_mapper.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/STL_Extension/internal/Has_nested_type_Has_filtered_predicates_tag.h>
#include <vector>
namespace CGAL {
@ -58,16 +59,18 @@ public:
using Self = Curve<T>;
static auto get_type()
{
if constexpr (::CGAL::internal::Has_nested_type_Has_filtered_predicates_tag<K>::value)
{
if constexpr (K::Has_filtered_predicates_tag::value) {
return typename K::Exact_kernel{};
} else {
}
}
if constexpr (std::is_floating_point_v<typename K::FT>)
return CGAL::Simple_cartesian<CGAL::Exact_rational>{};
else
return K{};
}
}
using Rational_kernel = decltype(get_type());

View File

@ -0,0 +1,24 @@
// Copyright (c) 2024 GeometryFactory Sarl (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Sébastien Loriot
#ifndef CGAL_HAS_NESTED_TYPE_HAS_FILTERED_PREDICATES_TAG_H
#define CGAL_HAS_NESTED_TYPE_HAS_FILTERED_PREDICATES_TAG_H
#include <boost/mpl/has_xxx.hpp>
namespace CGAL {
namespace internal {
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_Has_filtered_predicates_tag, Has_filtered_predicates_tag, false)
} } // end namespace CGAL::internal
#endif // CGAL_HAS_NESTED_TYPE_HAS_FILTERED_PREDICATES_TAG_H