aconstlink / motor

Software Framework for Audio/Visual/Interactive Real-Time Applications
MIT License
2 stars 0 forks source link

Can not use the mtr_rref_t types #7

Closed aconstlink closed 10 months ago

aconstlink commented 10 months ago

Unfortunately, the idea to pass managed pointers by value or by rref does not work because the compiler will complains about ambiguous overloads.

So we can not do something like this:

void_t some_funk( some_mtr_t ) ...
// ...
void_t some_funk( some_mtr_rref_t ) ...

Calling some_funk with a managed pointer will fail in compilation.

So there need to be some wrapper, so we can solve the moved managed pointer situation into some function and out of some function.

I propose something like this:

template< typename T >
class mtr_moved ;

So moved managed pointers could be noted like so

mtr_moved<some_class> some_funk() ...
// or
void_t some_funk( mtr_moved<some_class> ) ...

That would definitely solve the distinction problem.

Even more conveniently, we could make a movefunction so there is no need to write out mtr_moved<...> in any way:

some_funk( motor::move(some_mtr) ) ;