Nui
move_detector.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace Nui
4 {
9  {
10  public:
11  MoveDetector() = default;
12  MoveDetector(MoveDetector const&) = default;
13  MoveDetector(MoveDetector&& other) noexcept
14  {
15  other.wasMoved_ = true;
16  }
17  MoveDetector& operator=(MoveDetector const&) = default;
18  MoveDetector& operator=(MoveDetector&& other) noexcept
19  {
20  other.wasMoved_ = true;
21  return *this;
22  }
23 
24  bool wasMoved() const noexcept
25  {
26  return wasMoved_;
27  }
28 
29  private:
30  bool wasMoved_{false};
31  };
32 }
Utility class to detect if an object was moved.
Definition: move_detector.hpp:9
MoveDetector & operator=(MoveDetector &&other) noexcept
Definition: move_detector.hpp:18
MoveDetector(MoveDetector &&other) noexcept
Definition: move_detector.hpp:13
MoveDetector(MoveDetector const &)=default
MoveDetector()=default
bool wasMoved() const noexcept
Definition: move_detector.hpp:24
MoveDetector & operator=(MoveDetector const &)=default
Definition: file_dialog.hpp:6