aconstlink / motor

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

Ambiguous mtr_moved #13

Closed aconstlink closed 7 months ago

aconstlink commented 7 months ago

Unfortunately, the mtr_moved_t and mtr_t types are not that easily convertable. The compiler again complains about ambiguous calls

void funk( some_mtr_t ) ;
void funk( some_mtr_moved_t ) ;

Doesn't seem to work with implicit conversion from the mtr_moved_t to mtr_t due to ambiguity.

Thankfully the mtr_moved_t type still has its right to exist because it signifies a passed ownership which needs to be taken. The only real problem here is the style of acquiring the pointer from the mtr_moved_t type. This could be solved by just adding a function to it. The downside is that all the code sections need to be fitted to this new behavoir.

// pod copy of the pointer
some_mtr_t a = some_moved_mtr_object.mtr() ;
// move the pointer out
some_mtr_t a = some_moved_mtr_object.move() ;

I think I am ok with it because the mtr_moved_t type really was thought to display the purpose of the passed pointer, which is that the ownership of the passed pointer needs to be taken in our explicit memory management.