diff options
| author | Tyge Løvset <[email protected]> | 2022-10-27 23:21:13 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-10-27 23:21:13 +0200 |
| commit | 426d0a4cef8f9910fd4f8209ee0e57bd9ff4c1e8 (patch) | |
| tree | 68e8b4792ee3f914a7ae934d2cf40ece7483d362 /include | |
| parent | ce04aa8562b71a0c7ab7906132807150c724c258 (diff) | |
| parent | 89429e8e8242df35bc482c13c4a9f2b23e62e51d (diff) | |
| download | STC-modified-426d0a4cef8f9910fd4f8209ee0e57bd9ff4c1e8.tar.gz STC-modified-426d0a4cef8f9910fd4f8209ee0e57bd9ff4c1e8.zip | |
Merge branch 'master' of github.com:tylov/STC
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/carc.h | 10 | ||||
| -rw-r--r-- | include/stc/cbox.h | 10 | ||||
| -rw-r--r-- | include/stc/ccommon.h | 1 | ||||
| -rw-r--r-- | include/stc/template.h | 8 |
4 files changed, 17 insertions, 12 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h index 91de0931..4e03af9b 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -113,7 +113,7 @@ STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p) { } // c++: std::make_shared<_cx_value>(val) -STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) { +STC_INLINE _cx_self _cx_memb(_make)(_cx_value val) { _cx_self ptr; _cx_carc_rep *rep = c_alloc(_cx_carc_rep); *(ptr.use_count = &rep->counter) = 1; @@ -150,11 +150,11 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) { } #ifndef _i_no_emplace -STC_INLINE _cx_self _cx_memb(_new)(_cx_raw raw) - { return _cx_memb(_from)(i_keyfrom(raw)); } +STC_INLINE _cx_self _cx_memb(_from)(_cx_raw raw) + { return _cx_memb(_make)(i_keyfrom(raw)); } #else -STC_INLINE _cx_self _cx_memb(_new)(_cx_value val) - { return _cx_memb(_from)(val); } +STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) + { return _cx_memb(_make)(val); } #endif // does not use i_keyclone, so OK to always define. diff --git a/include/stc/cbox.h b/include/stc/cbox.h index cb8b7069..fb4452a4 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -94,7 +94,7 @@ STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p) { return c_make(_cx_self){p}; } // c++: std::make_unique<i_key>(val) -STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) { +STC_INLINE _cx_self _cx_memb(_make)(_cx_value val) { _cx_self ptr = {c_alloc(_cx_value)}; *ptr.get = val; return ptr; } @@ -129,11 +129,11 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) { } #ifndef _i_no_emplace -STC_INLINE _cx_self _cx_memb(_new)(_cx_raw raw) - { return _cx_memb(_from)(i_keyfrom(raw)); } +STC_INLINE _cx_self _cx_memb(_from)(_cx_raw raw) + { return _cx_memb(_make)(i_keyfrom(raw)); } #else -STC_INLINE _cx_self _cx_memb(_new)(_cx_value val) - { return _cx_memb(_from)(val); } +STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) + { return _cx_memb(_make)(val); } #endif #if !defined _i_no_clone diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index fb4129b3..8d1f236b 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -112,6 +112,7 @@ #define c_no_clone (1<<2) #define c_no_cmp (1<<3) #define c_no_hash (1<<4) +#define c_no_from (1<<5) /* Generic algorithms */ diff --git a/include/stc/template.h b/include/stc/template.h index ae66502d..42a07634 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -115,7 +115,9 @@ #elif defined i_keyboxed #define i_keyclass i_keyboxed #define i_rawclass c_paste(i_keyboxed, _raw) - #define i_keyfrom c_paste(i_keyboxed, _new) + #if !c_option(c_no_from) + #define i_keyfrom c_paste(i_keyboxed, _from) + #endif #if !defined _i_no_hash #define i_eq c_paste(i_keyboxed, _raw_eq) #endif @@ -215,7 +217,9 @@ #elif defined i_valboxed #define i_valclass i_valboxed #define i_valraw c_paste(i_valboxed, _raw) - #define i_valfrom c_paste(i_valboxed, _new) + #if !c_option(c_no_from) + #define i_valfrom c_paste(i_valboxed, _from) + #endif #endif #ifdef i_valclass |
