add noexcept specifier to Observer::Notify() methods

This commit is contained in:
falsycat 2023-08-01 20:49:16 +09:00
parent 7663ed9dea
commit 03981f2cd9
2 changed files with 6 additions and 6 deletions

View File

@ -20,9 +20,9 @@ class Observer {
inline virtual ~Observer() noexcept; inline virtual ~Observer() noexcept;
protected: protected:
virtual void Notify(const T&) {} virtual void Notify(const T&) noexcept {}
virtual void NotifyWithMove(T&& v) { Notify(v); } virtual void NotifyWithMove(T&& v) noexcept { Notify(v); }
virtual void NotifyDestruction(const T* = nullptr) {} virtual void NotifyDestruction(const T* = nullptr) noexcept {}
private: private:
Target& target_; Target& target_;

View File

@ -14,9 +14,9 @@ class ObserverMock : public Observer<T> {
explicit ObserverMock(Observer<T>::Target& target) : Observer<T>(target) { explicit ObserverMock(Observer<T>::Target& target) : Observer<T>(target) {
} }
MOCK_METHOD(void, Notify, (const T&)); MOCK_METHOD(void, Notify, (const T&), (noexcept, override));
MOCK_METHOD(void, NotifyWithMove, (T&&)); MOCK_METHOD(void, NotifyWithMove, (T&&), (noexcept, override));
MOCK_METHOD(void, NotifyDestruction, (const T*)); MOCK_METHOD(void, NotifyDestruction, (const T*), (noexcept, override));
}; };
template <typename T> template <typename T>