Skip to content
Snippets Groups Projects
Commit c0aefa7e authored by Yoel's avatar Yoel
Browse files

Changed some parameters to const-refs

parent 69a21f0d
No related branches found
No related tags found
No related merge requests found
...@@ -18,10 +18,10 @@ Threadpool::~Threadpool() { ...@@ -18,10 +18,10 @@ Threadpool::~Threadpool() {
alive = false; alive = false;
cv.notify_all(); cv.notify_all();
for (auto &thread : threads) thread.join(); for (auto& thread : threads) thread.join();
} }
void Threadpool::queueTask(std::function<void(void)> task) { void Threadpool::queueTask(const std::function<void(void)>& task) {
std::unique_lock<std::mutex> lock(m); std::unique_lock<std::mutex> lock(m);
q.emplace(task); q.emplace(task);
lock.unlock(); lock.unlock();
......
...@@ -13,7 +13,7 @@ class Threadpool { ...@@ -13,7 +13,7 @@ class Threadpool {
Threadpool(size_t n); Threadpool(size_t n);
~Threadpool(); ~Threadpool();
// Add a task to the queue // Add a task to the queue
void queueTask(std::function<void(void)> task); void queueTask(const std::function<void(void)>& task);
private: private:
void threading(); void threading();
......
#include "Transformation.h" #include "Transformation.h"
namespace util { namespace util {
util::Transformation::Transformation(Mat4 matrix) util::Transformation::Transformation(const Mat4& matrix)
: toWorld(matrix), : toWorld(matrix),
fromWorld(matrix.invertFull()), fromWorld(matrix.invertFull()),
toWorldN(matrix.invertFull().transpose()) { toWorldN(matrix.invertFull().transpose()) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace util { namespace util {
class Transformation { class Transformation {
public: public:
Transformation(Mat4 matrix); Transformation(const Mat4& matrix);
const Mat4 toWorld, fromWorld, toWorldN; const Mat4 toWorld, fromWorld, toWorldN;
}; };
} // namespace util } // namespace util
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment