Open Adda0 opened 1 year ago
Can you give me at least one example where it can help? (asking just from curiousity)
There was a comment to try to think of a way to utilize r-value references in trim or one of the functions used in trim, IIRC. I believe one could find surprisingly many occurrences where r-value references could be useful. And some algorithms could make use of it, too. Do we have an algorithm (using Mata library as a library) which is a current bottleneck where moves can be utilized? I do not know. But an overloaded version with r-value references could help there immensely. For instance, noodlification could potentially make use of moves. And other operations in Noodler using Mata as well. We usually destroy the previous automata later on.
However, this issue should mostly prompt us to spend some time thinking about using move operations now that we support them in our algorithms. So far, we have never implemented an algorithm with moves. When we refactor functions or write new ones, we need to think whether moves can be used there.
TLDR: Do you basically mean that it may be usefull in chaining operations on Nfa?
Basically. But maybe not only. We do not know the algorithms which could benefit from this yet.
I agree that some algorithms may benefit from them in elegance and efficiency so it is worth of time investment.
Seeing as we now have move constructors and assignments (#186, introduced in #195 and #233), we should consider implementing some functions operating with R-value references to see where they can be used and how they can help optimize different algorithms.
In addition, we will want to look through the code and try to spot places where we can use
std::move
to optimize algorithms and interface functions.