Skip to content

Commit

Permalink
Include comparisons only for Arc/Box types by default when i_rawclass…
Browse files Browse the repository at this point in the history
… is defined.
  • Loading branch information
tylov committed Oct 22, 2024
1 parent 3789759 commit 502d595
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/stc/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ int main(void) {
#ifndef _i_prefix
#define _i_prefix box_
#endif
#define _i_is_box
#include "priv/template.h"
typedef i_keyraw _m_raw;

Expand Down Expand Up @@ -159,6 +160,6 @@ STC_INLINE void _c_MEMB(_assign)(Self* self, Self* moved) {
STC_INLINE size_t _c_MEMB(_raw_hash)(const _m_raw* rx)
{ return i_hash(rx); }
#endif // i_no_hash

#undef _i_is_box
#include "priv/linkage2.h"
#include "priv/template2.h"
6 changes: 4 additions & 2 deletions include/stc/priv/template.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@
#endif

#if defined i_rawclass
#define i_use_cmp
#define i_use_eq
#if defined _i_is_arc || defined _i_is_box
#define i_use_cmp
#define i_use_eq
#endif
#if !(defined i_key || defined i_keyclass)
#define i_key i_rawclass
#define i_keytoraw c_default_toraw
Expand Down
1 change: 1 addition & 0 deletions misc/examples/algorithms/filterdemos.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fn main() {
*/
#define i_type SVec
#define i_rawclass csview // set both key+keyraw = csview. Bind comparison functions.
#define i_use_cmp
#include "stc/vec.h"

void demo3(void)
Expand Down

0 comments on commit 502d595

Please sign in to comment.