sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
108 stars 63 forks source link

Require C++11 for the C++ API #106

Closed tstenner closed 3 years ago

tstenner commented 3 years ago

The C++ API has wrapper types with lots of custom / disabled copy operations / destructors for the opaque C API handles. With C++11, it's possible to store the handles in shared_ptrs with custom deleters, so copying, moving and destroying objects is all handled by the compiler.

Another benefit is that handing out raw handles (see #105) is perfectly safe:

shared_ptr<lsl_struct_outlet_> raw_handle = stream_outlet(…).get_raw_handle();
// the stream outlet goes out of scope
lsl_push_foo(raw_handle.get());
// the handle to the outlet is still valid, until raw_handle goes out of scope, too.
tstenner commented 3 years ago

Nominating @chkothe as person most likely to know someone who would be against this :-)