Skip to content

Commit

Permalink
add a macro to ease the check
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot committed Mar 25, 2024
1 parent fa87706 commit 880de2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions STL_Extension/include/CGAL/Named_function_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,16 @@ bool authorized_options(const Named_function_parameters& np)

} // end of parameters namespace

#ifdef CGAL_NDEBUG
#define CGAL_CHECK_AUTHORIZED_NAMED_PARAMETERS(np, ...)
#else
#define CGAL_CHECK_AUTHORIZED_NAMED_PARAMETERS(np, ...) \
{ \
using namespace ::CGAL::internal_np; \
static_assert(::CGAL::parameters::authorized_options<__VA_ARGS__>(np)); \
}
#endif

#ifndef CGAL_NO_DEPRECATED_CODE
namespace Polygon_mesh_processing {

Expand Down
3 changes: 3 additions & 0 deletions STL_Extension/test/STL_Extension/test_cgal_named_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void test_authorized_options()
static_assert(!CGAL::parameters::authorized_options<CGAL::internal_np::vertex_point_t,
CGAL::internal_np::edge_index_t,
CGAL::internal_np::face_index_t>(np_ko));

CGAL_CHECK_AUTHORIZED_NAMED_PARAMETERS(np_ok1, vertex_point_t, edge_index_t, face_index_t);
CGAL_CHECK_AUTHORIZED_NAMED_PARAMETERS(np_ok2, vertex_point_t, edge_index_t, face_index_t);
}

int main()
Expand Down

0 comments on commit 880de2e

Please sign in to comment.