Skip to content

Commit ea8d366

Browse files
committed
use struct as np variable is not a constexpr
1 parent eba48ec commit ea8d366

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

STL_Extension/include/CGAL/Named_function_parameters.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -589,35 +589,35 @@ bool is_tag_present(Tag_wrapper<TagAllowed, TagsAllowed...>, Tag)
589589
return is_tag_present(Tag_wrapper<TagsAllowed...>(), Tag());
590590
}
591591

592-
template <class ... TagsAllowed, class T, class Tag>
593-
constexpr
594-
bool authorized_options_rec(const Named_function_parameters<T, Tag>&)
595-
{
596-
if constexpr (std::is_same_v<Tag, internal_np::do_not_check_allowed_np_t>)
597-
return true;
598-
return is_tag_present(Tag_wrapper<TagsAllowed...>(), Tag());
599-
}
592+
template<class NP, class ... TagsAllowed>
593+
struct Authorized_options_rec;
600594

601595
template <class ... TagsAllowed, class T, class Tag, class Base>
602-
constexpr
603-
bool authorized_options_rec(const Named_function_parameters<T, Tag, Base>& np)
596+
struct Authorized_options_rec< Named_function_parameters<T, Tag, Base>, TagsAllowed...>
604597
{
605-
if constexpr (std::is_same_v<Tag, internal_np::do_not_check_allowed_np_t>)
606-
return true;
607-
if (is_tag_present(Tag_wrapper<TagsAllowed...>(), Tag()))
608-
return authorized_options_rec<TagsAllowed...>(static_cast<const Base&>(np));
609-
return false;
610-
}
598+
static constexpr bool value =
599+
std::is_same_v<Tag, internal_np::do_not_check_allowed_np_t> ||
600+
(is_tag_present(Tag_wrapper<TagsAllowed...>(), Tag()) || Authorized_options_rec<Base, TagsAllowed...>::value);
601+
602+
};
603+
604+
template <class ... TagsAllowed, class T, class Tag>
605+
struct Authorized_options_rec< Named_function_parameters<T, Tag>, TagsAllowed...>
606+
{
607+
static constexpr bool value =
608+
std::is_same_v<Tag, internal_np::do_not_check_allowed_np_t> || is_tag_present(Tag_wrapper<TagsAllowed...>(), Tag());
609+
};
611610

612611
}// impl namespace
613612

614-
template <class ... TagsAllowed, class Named_function_parameters>
613+
template <class Named_function_parameters, class ... TagsAllowed>
615614
constexpr
616-
bool authorized_options(const Named_function_parameters& np)
615+
bool authorized_options()
617616
{
618617
#ifndef CGAL_DISABLE_NAMED_FUNCTION_PARAMETERS_CHECKS
619-
return authorized_parameters_impl::authorized_options_rec
620-
<internal_np::all_default_t, TagsAllowed...>(np);
618+
using NP = cpp20::remove_cvref_t<Named_function_parameters>;
619+
return authorized_parameters_impl::Authorized_options_rec
620+
<NP, internal_np::all_default_t, TagsAllowed...>::value;
621621
#else
622622
return true;
623623
#endif
@@ -631,7 +631,7 @@ bool authorized_options(const Named_function_parameters& np)
631631
#define CGAL_CHECK_AUTHORIZED_NAMED_PARAMETERS(np, ...) \
632632
{ \
633633
using namespace ::CGAL::internal_np; \
634-
static_assert(::CGAL::parameters::authorized_options<__VA_ARGS__>(np)); \
634+
static_assert(::CGAL::parameters::authorized_options<decltype(np), __VA_ARGS__>()); \
635635
}
636636
#endif
637637

0 commit comments

Comments
 (0)