Skip to content

Commit

Permalink
Merge branch 'master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot committed Jun 22, 2023
2 parents f936680 + cce3dfd commit dfc386d
Show file tree
Hide file tree
Showing 257 changed files with 1,965 additions and 1,173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ template<typename Ray, typename SkipFunctor>
boost::optional< typename AABB_tree<AABBTraits>::template Intersection_and_primitive_id<Ray>::Type >
AABB_tree<AABBTraits>::first_intersection(const Ray& query,
const SkipFunctor& skip) const {
CGAL_static_assertion_msg((std::is_same<Ray, typename AABBTraits::Ray_3>::value),
static_assert(std::is_same<Ray, typename AABBTraits::Ray_3>::value,
"Ray and Ray_3 must be the same type");

switch(size()) // copy-paste from AABB_tree::traversal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ int main()
{
using namespace CGAL::internal::AABB_tree;

CGAL_static_assertion_msg(
static_assert(
(Is_ray_intersection_geomtraits<CGAL::Epeck>::value),
"CGAL::Epeck should be a RayIntersectionGeomTraits");
CGAL_static_assertion_msg(
static_assert(
(Is_ray_intersection_geomtraits< CGAL::Simple_cartesian<double> >::value),
"CGAL::Epeck should be a RayIntersectionGeomTraits");
CGAL_static_assertion_msg(
static_assert(
(!Is_ray_intersection_geomtraits<AABBGeomTraits>::value),
"Pure AABBGeomTraits shouldn't be a RayIntersectionGeomTraits");
CGAL_static_assertion_msg(
static_assert(
(!Is_ray_intersection_geomtraits<nope>::value),
"The empty struct shouldn't be a RayIntersectionGeomTraits");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ int main(){
typedef FT::Numerator_type Numerator_type;
typedef FT::Denominator_type Denominator_type;

CGAL_static_assertion((std::is_same<Numerator_type,CGAL::Gmpz>::value));
CGAL_static_assertion((std::is_same<Denominator_type,CGAL::Gmpz>::value));
static_assert(std::is_same<Numerator_type,CGAL::Gmpz>::value);
static_assert(std::is_same<Denominator_type,CGAL::Gmpz>::value);

Numerator_type numerator;
Denominator_type denominator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ binary_func(const A& a , const B& b){
typedef CGAL::Coercion_traits<A,B> CT;

// check for explicit interoperability
CGAL_static_assertion((CT::Are_explicit_interoperable::value));
static_assert(CT::Are_explicit_interoperable::value);

// CT::Cast is used to to convert both types into the coercion type
typename CT::Cast cast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,7 @@ class Algebraic_structure_traits_base< Type_,
typedef Coercion_traits< NT1, NT2 > CT;
typedef typename CT::Type Coercion_type_NT1_NT2;
CGAL_USE_TYPE(Coercion_type_NT1_NT2);
CGAL_static_assertion((
::std::is_same<Coercion_type_NT1_NT2 , Type >::value));
static_assert(::std::is_same<Coercion_type_NT1_NT2 , Type >::value);

typename Coercion_traits< NT1, NT2 >::Cast cast;
operator()( cast(x), cast(y), q, r );
Expand Down
4 changes: 2 additions & 2 deletions Algebraic_foundations/include/CGAL/Coercion_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
#define CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, Result_type ) \
template < class CT_Type_1, class CT_Type_2 > \
Result_type operator()( const CT_Type_1& x, const CT_Type_2& y ) const { \
CGAL_static_assertion((::std::is_same< \
static_assert(::std::is_same< \
typename Coercion_traits< CT_Type_1, CT_Type_2 >::Type, NT \
>::value)); \
>::value) ; \
\
typename Coercion_traits< CT_Type_1, CT_Type_2 >::Cast cast; \
return operator()( cast(x), cast(y) ); \
Expand Down
4 changes: 2 additions & 2 deletions Algebraic_foundations/include/CGAL/Scalar_factor_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ class Scalar_factor_traits {

// determine extractable scalar factor
Scalar operator () (const NT& a) {
CGAL_static_assertion(( ::std::is_same< NT,Scalar >::value));
static_assert(::std::is_same< NT,Scalar >::value);
typedef typename Algebraic_structure_traits<NT>::Algebraic_category SAT;
return scalar_factor(a, SAT());
}
// determine extractable scalar factor
Scalar operator () (const NT& a, const Scalar& d) {
CGAL_static_assertion(( ::std::is_same< NT,Scalar >::value));
static_assert(::std::is_same< NT,Scalar >::value);
typedef typename Algebraic_structure_traits<NT>::Algebraic_category SAT;
return scalar_factor(a,d,SAT());
}
Expand Down
64 changes: 28 additions & 36 deletions Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
template <typename AdaptableFunctor, typename ResultType>
void check_result_type(AdaptableFunctor, ResultType){
typedef typename AdaptableFunctor::result_type result_type;
CGAL_static_assertion((::std::is_same<result_type,ResultType>::value));
static_assert(::std::is_same<result_type,ResultType>::value);
CGAL_USE_TYPE(result_type);
}
// check nothing for CGAL::Null_functor
Expand Down Expand Up @@ -122,12 +122,11 @@ void test_algebraic_structure_intern( const CGAL::Integral_domain_tag& ) {
CGAL_SNAP_AST_FUNCTORS(AST);

using CGAL::Null_functor;
CGAL_static_assertion(
(!::std::is_same< Integral_division, Null_functor >::value));
CGAL_static_assertion((!::std::is_same< Divides, Null_functor >::value));
CGAL_static_assertion((!::std::is_same< Is_zero, Null_functor >::value));
CGAL_static_assertion((!::std::is_same< Is_one, Null_functor >::value));
CGAL_static_assertion((!::std::is_same< Square, Null_functor >::value));
static_assert(!::std::is_same< Integral_division, Null_functor >::value);
static_assert(!::std::is_same< Divides, Null_functor >::value);
static_assert(!::std::is_same< Is_zero, Null_functor >::value);
static_assert(!::std::is_same< Is_one, Null_functor >::value);
static_assert(!::std::is_same< Square, Null_functor >::value);

// functor
const Is_zero is_zero = Is_zero();
Expand Down Expand Up @@ -206,7 +205,7 @@ void test_algebraic_structure_intern(
CGAL_SNAP_AST_FUNCTORS(AST);

using CGAL::Null_functor;
CGAL_static_assertion((!::std::is_same< Gcd, Null_functor>::value));
static_assert(!::std::is_same< Gcd, Null_functor>::value);

const Gcd gcd = Gcd();
assert( gcd( AS ( 0), AS ( 0)) == unit_normal( AS (0) ) );
Expand Down Expand Up @@ -268,9 +267,9 @@ void test_algebraic_structure_intern( const CGAL::Euclidean_ring_tag&) {
CGAL_SNAP_AST_FUNCTORS(AST);

using CGAL::Null_functor;
CGAL_static_assertion((!::std::is_same< Div, Null_functor>::value));
CGAL_static_assertion((!::std::is_same< Mod, Null_functor>::value));
CGAL_static_assertion((!::std::is_same< Div_mod, Null_functor>::value));
static_assert(!::std::is_same< Div, Null_functor>::value);
static_assert(!::std::is_same< Mod, Null_functor>::value);
static_assert(!::std::is_same< Div_mod, Null_functor>::value);

const Div div=Div();
const Mod mod=Mod();
Expand Down Expand Up @@ -387,7 +386,7 @@ void test_algebraic_structure_intern( const CGAL::Field_with_sqrt_tag& ) {

CGAL_SNAP_AST_FUNCTORS(AST);

CGAL_static_assertion((!::std::is_same< Sqrt, Null_functor>::value));
static_assert(!::std::is_same< Sqrt, Null_functor>::value);
const Sqrt sqrt =Sqrt();
AS a(4);

Expand Down Expand Up @@ -613,11 +612,9 @@ class Test_is_square {
CGAL_USE_TYPE(First_argument_type);
CGAL_USE_TYPE(Second_argument_type);

CGAL_static_assertion(
( ::std::is_same< AS , First_argument_type>::value));
CGAL_static_assertion(
( ::std::is_same< AS& , Second_argument_type>::value));
//CGAL_static_assertion(( ::std::is_same< bool , Result_type>::value));
static_assert(::std::is_same< AS , First_argument_type>::value);
static_assert(::std::is_same< AS& , Second_argument_type>::value);
//static_assert(::std::is_same< bool , Result_type>::value);
bool b = Result_type(true); CGAL_USE(b);

AS test_number = AS(3)*AS(3);
Expand Down Expand Up @@ -649,8 +646,8 @@ class Test_sqrt {
typedef typename Sqrt::result_type Result_type;
CGAL_USE_TYPE(Argument_type);
CGAL_USE_TYPE(Result_type);
CGAL_static_assertion(( ::std::is_same< AS , Argument_type>::value));
CGAL_static_assertion(( ::std::is_same< AS , Result_type>::value));
static_assert(::std::is_same< AS , Argument_type>::value);
static_assert(::std::is_same< AS , Result_type>::value);
typedef Algebraic_structure_traits<AS> AST;
typedef typename AST::Is_exact Is_exact;
assert( !Is_exact::value || AS (3) == sqrt( AS (9)));
Expand All @@ -675,12 +672,9 @@ class Test_root {
CGAL_USE_TYPE(First_argument_type);
CGAL_USE_TYPE(Second_argument_type);
CGAL_USE_TYPE(Result_type);
CGAL_static_assertion(
( ::std::is_same<int, First_argument_type>::value));
CGAL_static_assertion(
( ::std::is_same< AS , Second_argument_type>::value));
CGAL_static_assertion(
( ::std::is_same< AS , Result_type>::value));
static_assert(::std::is_same<int, First_argument_type>::value);
static_assert(::std::is_same< AS , Second_argument_type>::value);
static_assert(::std::is_same< AS , Result_type>::value);
AS epsilon(1);
assert( test_equality_epsilon( AS (2),
root( 4, AS (16) ), epsilon ) );
Expand Down Expand Up @@ -803,7 +797,7 @@ void test_algebraic_structure(){
typedef CGAL::Algebraic_structure_traits< AS > AST;
CGAL_SNAP_AST_FUNCTORS(AST);

CGAL_static_assertion((::std::is_same<AS,typename AST::Type>::value));
static_assert(::std::is_same<AS,typename AST::Type>::value);

typedef typename AST::Boolean Boolean;
assert(!Boolean());
Expand All @@ -816,14 +810,13 @@ void test_algebraic_structure(){
using CGAL::Integral_domain_without_division_tag;
using CGAL::Null_functor;
// Test for desired exactness
CGAL_static_assertion(
( ::std::is_same< typename AST::Is_exact, Is_exact >::value));

CGAL_static_assertion(( ::std::is_convertible< Tag,
Integral_domain_without_division_tag >::value ));
CGAL_static_assertion(( ::std::is_same< Tag, Algebraic_category>::value));
CGAL_static_assertion((!::std::is_same< Simplify, Null_functor>::value));
CGAL_static_assertion((!::std::is_same< Unit_part, Null_functor>::value));
static_assert(::std::is_same< typename AST::Is_exact, Is_exact >::value);
static_assert(::std::is_convertible< Tag,
Integral_domain_without_division_tag >::value );
static_assert(::std::is_same< Tag, Algebraic_category>::value);
static_assert(!::std::is_same< Simplify, Null_functor>::value);
static_assert(!::std::is_same< Unit_part, Null_functor>::value);

const Simplify simplify=Simplify();;
const Unit_part unit_part= Unit_part();

Expand Down Expand Up @@ -943,8 +936,7 @@ void test_algebraic_structure( const AS & a, const AS & b, const AS & c) {

typedef CGAL::Algebraic_structure_traits<AS> AST;
typedef typename AST::Is_numerical_sensitive Is_numerical_sensitive;
CGAL_static_assertion(
!(::std::is_same<Is_numerical_sensitive, CGAL::Null_tag>::value));
static_assert(!::std::is_same<Is_numerical_sensitive, CGAL::Null_tag>::value);
CGAL_USE_TYPE(Is_numerical_sensitive);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void test_implicit_interoperable_one_way() {
typedef typename CT::Type C;
typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable;

CGAL_static_assertion(
static_assert(
(::std::is_same<Are_implicit_interoperable, CGAL::Tag_true>::value));
assert((::std::is_same<Are_implicit_interoperable, CGAL::Tag_true>::value));

Expand All @@ -346,9 +346,9 @@ void test_explicit_interoperable_one_way(){
typedef typename CT::Cast Cast;
typedef typename Cast::result_type result_type;
CGAL_USE_TYPE(result_type);
CGAL_static_assertion((::std::is_same<result_type,Type>::value));
CGAL_static_assertion((::std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value));
CGAL_static_assertion((::std::is_same<Type,RT>::value));
static_assert(::std::is_same<result_type,Type>::value);
static_assert(::std::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value);
static_assert(::std::is_same<Type,RT>::value);
typename CT::Cast cast;

A a(3);
Expand Down
10 changes: 5 additions & 5 deletions Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ void test_fraction_traits(){
typedef typename FT::Compose Compose;

CGAL_USE_TYPE(Is_fraction);
CGAL_static_assertion( (::std::is_same<Type,T>::value));
CGAL_static_assertion( (::std::is_same<Is_fraction,Tag_true>::value));
CGAL_static_assertion(!(::std::is_same<Common_factor,Null_functor>::value));
CGAL_static_assertion(!(::std::is_same<Decompose,Null_functor>::value));
CGAL_static_assertion(!(::std::is_same<Compose,Null_functor>::value));
static_assert(::std::is_same<Type,T>::value);
static_assert(::std::is_same<Is_fraction,Tag_true>::value);
static_assert(!::std::is_same<Common_factor,Null_functor>::value);
static_assert(!::std::is_same<Decompose,Null_functor>::value);
static_assert(!::std::is_same<Compose,Null_functor>::value);


// Decompose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void test_rational_traits(){

typedef Rational_traits<Rational> Rational_traits;
typedef typename Rational_traits::RT RT;
CGAL_static_assertion((::std::is_same<RT,RT>::value));
static_assert(::std::is_same<RT,RT>::value);

assert( Rational_traits().numerator(x) == RT(7));
assert( Rational_traits().denominator(x) == RT(2));
Expand Down
16 changes: 8 additions & 8 deletions Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ namespace CGAL {
void operator() (const ToDouble& to_double) {
typedef typename ToDouble::argument_type Argument_type;
typedef typename ToDouble::result_type Result_type;
CGAL_static_assertion(( ::std::is_same<Type, Argument_type>::value));
static_assert( ::std::is_same<Type, Argument_type>::value);
CGAL_USE_TYPE(Argument_type);
CGAL_static_assertion(( ::std::is_same<double, Result_type>::value));
static_assert( ::std::is_same<double, Result_type>::value);
CGAL_USE_TYPE(Result_type);
assert(42.0 == to_double(Type(42)));
}
Expand All @@ -71,9 +71,9 @@ namespace CGAL {
typedef typename To_interval::argument_type Argument_type;
typedef typename To_interval::result_type Result_type;
typedef std::pair<double,double> Interval_type;
CGAL_static_assertion(( ::std::is_same<Type, Argument_type>::value));
static_assert( ::std::is_same<Type, Argument_type>::value);
CGAL_USE_TYPE(Argument_type);
CGAL_static_assertion(( ::std::is_same<Interval_type, Result_type>::value));
static_assert( ::std::is_same<Interval_type, Result_type>::value);
CGAL_USE_TYPE(Result_type); CGAL_USE_TYPE(Interval_type);

// assert(NiX::in(42.0,to_Interval(Type(42))));
Expand Down Expand Up @@ -139,7 +139,7 @@ void test_real_embeddable() {
CGAL_SNAP_RET_FUNCTORS(RET);
typedef typename RET::Is_real_embeddable Is_real_embeddable;
using CGAL::Tag_true;
CGAL_static_assertion(( ::std::is_same< Is_real_embeddable, Tag_true>::value));
static_assert(::std::is_same< Is_real_embeddable, Tag_true>::value);
CGAL_USE_TYPE(Is_real_embeddable);

typedef typename RET::Boolean Boolean;
Expand Down Expand Up @@ -246,21 +246,21 @@ void test_not_real_embeddable() {
typedef CGAL::Real_embeddable_traits<Type> RET;
typedef typename RET::Is_real_embeddable Is_real_embeddable;
using CGAL::Tag_false;
CGAL_static_assertion(( ::std::is_same< Is_real_embeddable, Tag_false>::value));
static_assert(::std::is_same< Is_real_embeddable, Tag_false>::value);
CGAL_USE_TYPE(Is_real_embeddable);
}


//template <class Type, class CeilLog2Abs>
//void test_rounded_log2_abs(Type zero, CGAL::Null_functor, CeilLog2Abs) {
// typedef CGAL::Null_functor Null_functor;
// CGAL_static_assertion(( ::std::is_same< CeilLog2Abs, Null_functor>::value));
// static_assert(::std::is_same< CeilLog2Abs, Null_functor>::value);
//}
//
//template <class Type, class FloorLog2Abs, class CeilLog2Abs>
//void test_rounded_log2_abs(Type zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) {
// typedef CGAL::Null_functor Null_functor;
// CGAL_static_assertion((!::std::is_same< CeilLog2Abs, Null_functor>::value));
// static_assert(!::std::is_same< CeilLog2Abs, Null_functor>::value);
//
// assert( fl_log(Type( 7)) == 2 );
// assert( cl_log(Type( 7)) == 3 );
Expand Down
Loading

0 comments on commit dfc386d

Please sign in to comment.