QBasicTimer: add some noexcept and constexpr
The noexcept part should be clear. The constexpr should make the compiler not create initialization code for static instances. This is how std::mutex works[1], and Clang and GCC understand it. MSVC doesn't. [1] https://en.cppreference.com/w/cpp/thread/mutex/mutex Change-Id: If9e4c6c0279f0024a659d5602d55e126224ca950 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
parent
4965b0ed77
commit
8fe6f14bf0
|
|
@ -63,7 +63,7 @@ public:
|
|||
#endif
|
||||
|
||||
public:
|
||||
inline QBasicTimer() : id(0) {}
|
||||
constexpr QBasicTimer() noexcept : id{0} {}
|
||||
inline ~QBasicTimer() { if (id) stop(); }
|
||||
|
||||
QBasicTimer(QBasicTimer &&other) noexcept
|
||||
|
|
@ -78,8 +78,8 @@ public:
|
|||
|
||||
void swap(QBasicTimer &other) noexcept { qSwap(id, other.id); }
|
||||
|
||||
inline bool isActive() const { return id != 0; }
|
||||
inline int timerId() const { return id; }
|
||||
bool isActive() const noexcept { return id != 0; }
|
||||
int timerId() const noexcept { return id; }
|
||||
|
||||
void start(int msec, QObject *obj);
|
||||
void start(int msec, Qt::TimerType timerType, QObject *obj);
|
||||
|
|
|
|||
Loading…
Reference in New Issue