From 0df0908723203276091061dd2803b7fd6dcf8a6e Mon Sep 17 00:00:00 2001 From: Neil Haran Date: Sat, 18 Jul 2020 13:06:14 +0100 Subject: [PATCH] In C++ version, use const-reference in QrSegment ctor rather than deep copy. --- cpp/QrCode.cpp | 4 ++-- cpp/QrCode.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index b9de862..fa5b8fd 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -156,7 +156,7 @@ QrSegment QrSegment::makeEci(long assignVal) { } -QrSegment::QrSegment(Mode md, int numCh, const std::vector &dt) : +QrSegment::QrSegment(const Mode &md, int numCh, const std::vector &dt) : mode(md), numChars(numCh), data(dt) { @@ -165,7 +165,7 @@ QrSegment::QrSegment(Mode md, int numCh, const std::vector &dt) : } -QrSegment::QrSegment(Mode md, int numCh, std::vector &&dt) : +QrSegment::QrSegment(const Mode &md, int numCh, std::vector &&dt) : mode(md), numChars(numCh), data(std::move(dt)) { diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index 7341e41..06d661a 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -170,7 +170,7 @@ class QrSegment final { * The character count (numCh) must agree with the mode and the bit buffer length, * but the constraint isn't checked. The given bit buffer is copied and stored. */ - public: QrSegment(Mode md, int numCh, const std::vector &dt); + public: QrSegment(const Mode &md, int numCh, const std::vector &dt); /* @@ -178,7 +178,7 @@ class QrSegment final { * The character count (numCh) must agree with the mode and the bit buffer length, * but the constraint isn't checked. The given bit buffer is moved and stored. */ - public: QrSegment(Mode md, int numCh, std::vector &&dt); + public: QrSegment(const Mode &md, int numCh, std::vector &&dt); /*---- Methods ----*/