lamarrr/STX

Removing R-value reference constraint in constructors for trivial types

Mazrog opened this issue · 1 comments

Hello !

Would it be feasible to add a constraint on the constructor of some types like Err Ok, or Some to remove the rvalue-reference on its argument when it comes to trivial types?

When working with enums or other trivial types as error-type, I find the need to move them a bit noisy in the code.

So I thought maybe it would be doable to have a constructor for trivial (that would do a plain copy, what would a move do implicitly), and another one for the general case as it is now.

The condition could be a standard trait, or even a custom one, that users could specialize if they want their types to be considered as trivial. (I do not have this need, but perhaps it could be interesting for some people)

Thank you for you work on this project, I like it!

Hi
I suppose it makes sense to allow copying trivially copyable types but it leads to more template mess and the code complexity just isn't worth it