ublas
ublas copied to clipboard
fix(lifetime): extending the lifetime of temporary objects
The current implementation does not take into account the prvalue that creates an issue while storing it. The prvalue is destroyed after the end of its scope, and if you try to access it, you are entering into the undefined land of C++.
To solve this issue, we employ the trait std::is_lvalue_reference
to
determine if need to extend the lifetime or not. If an extension is needed,
we store the value with the help of universal forwarding. Otherwise, we
extend the lifetime using const &
.
Resolves #125, resolves #118
This Pull request Passed all of clang-tidy tests. :+1: