From a217475d42fc75cdb09cdf72f3e1e24d14ae5be1 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Mon, 13 Sep 2021 00:20:38 +0200 Subject: [PATCH] Util: Avoid assigning variable by passing to the initialization list When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. --- src/util/timer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/timer.cpp b/src/util/timer.cpp index 867f3e9..59d99ab 100644 --- a/src/util/timer.cpp +++ b/src/util/timer.cpp @@ -7,8 +7,8 @@ namespace Util { Timer::Timer() + : m_start(std::chrono::high_resolution_clock::now()) { - m_start = std::chrono::high_resolution_clock::now(); } Timer Timer::operator-(const Timer& timer)