fixstars / ion-kit

Modernized graph-based data processing framework
MIT License
7 stars 6 forks source link

Fix/port index access in capi #263

Closed xinyuli1204 closed 3 months ago

xinyuli1204 commented 3 months ago
auto p = new Port(*reinterpret_cast<Port*>(obj)); 
p->set_index(index); 
*ptr = reinterpret_cast<ion_port_t>(p); 

reinterpret_cast<ion::Port*>(obj)->set_index(index);

obj doen't need to set_index, otherwise have issue on following example p0 = ports[0] (make a copy of ports and set index to 0) p1 = ports[1] (make a copy of ports and set index to 1) when access ports again, the index of ports will be 1 instead of -1