[C++11] Avoid implicit conversion of ArrayRef to std::vector and use move semantics where appropriate.