blob: fac575d9df08fbafec9ac579f35fb50125a4a134 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef TEST_SUPPORT_DOUBLE_MOVE_TRACKER_H
#define TEST_SUPPORT_DOUBLE_MOVE_TRACKER_H
#include <cassert>
#include "test_macros.h"
namespace support {
struct double_move_tracker {
TEST_CONSTEXPR double_move_tracker() : moved_from_(false) {}
double_move_tracker(double_move_tracker const&) = default;
TEST_CONSTEXPR_CXX14 double_move_tracker(double_move_tracker&& other) : moved_from_(false) {
assert(!other.moved_from_);
other.moved_from_ = true;
}
double_move_tracker& operator=(double_move_tracker const&) = default;
TEST_CONSTEXPR_CXX14 double_move_tracker& operator=(double_move_tracker&& other) {
assert(!other.moved_from_);
other.moved_from_ = true;
moved_from_ = false;
return *this;
}
private:
bool moved_from_;
};
} // namespace support
#endif // TEST_SUPPORT_DOUBLE_MOVE_TRACKER_H
|