Is the right way to use C++11 rvalue-references and move semantics to implement a convenience wrapper for std::reverse()
?
template <class BIDirContainer> inline BIDirContainer&& reverse(BIDirContainer a) {
std::reverse(begin(a), end(a));
return std::move(a);
}
The code works in my test case but I am unsure its about performance: should I use &&
here or is it unneccesary?
No comments:
Post a Comment