summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cbox.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-08-11 17:58:15 +0200
committerTyge Løvset <[email protected]>2022-08-11 17:58:15 +0200
commit5cf6b762012168be51b32a1a85ab2bc33504f020 (patch)
tree9fd59787a0d33d23196b77cecbd31ef5d44e103a /include/stc/cbox.h
parent9831e8d6ee6772a4f9899cf9e3d36e3de47bbaf5 (diff)
downloadSTC-modified-5cf6b762012168be51b32a1a85ab2bc33504f020.tar.gz
STC-modified-5cf6b762012168be51b32a1a85ab2bc33504f020.zip
Fixed issue with cbox / carc. Minor update some examples.
Diffstat (limited to 'include/stc/cbox.h')
-rw-r--r--include/stc/cbox.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index c3a9dd02..467dd645 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -48,7 +48,7 @@ void Person_drop(Person* p) {
int main() {
c_auto (PBox, p, q)
{
- p = PBox_make(Person_from("John Smiths", "[email protected]"));
+ p = PBox_from(Person_from("John Smiths", "[email protected]"));
q = PBox_clone(p);
cstr_assign(&q.get->name, "Joe Smiths");
@@ -89,10 +89,13 @@ 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(_make)(_cx_value val) {
+STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) {
_cx_self ptr = {c_alloc(_cx_value)};
*ptr.get = val; return ptr;
}
+// [deprecated]
+STC_INLINE _cx_self _cx_memb(_make)(_cx_value val)
+ { return _cx_memb(_from)(val); }
STC_INLINE _cx_raw _cx_memb(_toraw)(const _cx_self* self)
{ return i_keyto(self->get); }
@@ -128,8 +131,8 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) {
#if !defined _i_no_clone
#if !defined _i_no_emplace
- STC_INLINE _cx_self _cx_memb(_from)(_cx_raw raw)
- { return _cx_memb(_make)(i_keyfrom(raw)); }
+ STC_INLINE _cx_self _cx_memb(_new)(_cx_raw raw)
+ { return _cx_memb(_from)(i_keyfrom(raw)); }
#endif
STC_INLINE _cx_self _cx_memb(_clone)(_cx_self other) {
if (!other.get)