• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_TEST_GMOCK_MOVE_SUPPORT_H_
6 #define BASE_TEST_GMOCK_MOVE_SUPPORT_H_
7 
8 #include <cstddef>
9 #include <tuple>
10 #include <utility>
11 
12 // A similar action as testing::SaveArg, but it does an assignment with
13 // std::move() instead of always performing a copy.
14 template <size_t I = 0, typename T>
MoveArg(T * out)15 auto MoveArg(T* out) {
16   return [out](auto&&... args) {
17     *out = std::move(std::get<I>(std::tie(args...)));
18   };
19 }
20 
21 #endif  // BASE_TEST_GMOCK_MOVE_SUPPORT_H_
22