Skip to content

Commit fdc7f48

Browse files
committed
Basing internal relation checks on internal ops apply (equal and not_equal only for now)
1 parent 4595c48 commit fdc7f48

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

include/alp/base/internalrels.hpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <alp/backends.hpp>
2929
#include <alp/type_traits.hpp>
3030

31+
#include "internalops.hpp"
32+
3133

3234
namespace alp {
3335

@@ -209,12 +211,9 @@ namespace alp {
209211
/**
210212
* Standard equal (\a eq) relation.
211213
*
212-
* Assumes native availability of \a operator== on the given data types
213-
* or assumes that the relevant operators are properly overloaded.
214-
*
215-
* Assumes that \a eq is an equivalence relation.
216-
* Non-standard/non-matching data types or non-standard (overloaded)
217-
* \a operator== should therefore be used with caution.
214+
* Assumes native availability of ALP internal operator \a less_than
215+
* forming an equivalence relation on SET. Non-standard/non-matching
216+
* data types should therefore be used with caution.
218217
*
219218
* @tparam SET The input data type.
220219
*/
@@ -287,21 +286,23 @@ namespace alp {
287286
static bool check( const domain * const a,
288287
const codomain * const b
289288
) {
290-
return *a == *b;
289+
bool check;
290+
operators::internal::template equal<
291+
SET, SET, bool, implementation
292+
>::apply( a, b, &check );
293+
return check;
291294
}
292295
};
293296

294297
/**
295298
* Standard not-equal (\a neq) operator.
296299
*
297-
* Assumes native availability of \a operator!= on the given data types
298-
* or assumes that the relevant operators are properly overloaded.
300+
* Assumes availability of ALP internal operator \a not_equal.
299301
*
300-
* While \a neq does not require two values to be members of
301-
* an ordered set, the relation is still assumed to be irreflexive,
302-
* symmetric and connected.
303-
* Non-standard/non-matching data types or non-standard (overloaded)
304-
* \a operator!= should therefore be used with caution.
302+
* While \a not_equal does not require to form an order or an
303+
* equivalence relation on SET, the formed relation is still assumed
304+
* to be irreflexive, symmetric, and connected. Non-standard/non-matching
305+
* data types should therefore be used with caution.
305306
*
306307
* @tparam SET The input data type.
307308
*/
@@ -374,7 +375,11 @@ namespace alp {
374375
static bool check( const domain * const a,
375376
const codomain * const b
376377
) {
377-
return *a != *b;
378+
bool check;
379+
operators::internal::template not_equal<
380+
SET, SET, bool, implementation
381+
>::apply( a, b, &check );
382+
return check;
378383
}
379384
};
380385

0 commit comments

Comments
 (0)