In C++ version, use const-reference in QrSegment ctor rather than deep copy.

pull/92/head
Neil Haran 4 years ago
parent 08ac806145
commit 0df0908723

@ -156,7 +156,7 @@ QrSegment QrSegment::makeEci(long assignVal) {
} }
QrSegment::QrSegment(Mode md, int numCh, const std::vector<bool> &dt) : QrSegment::QrSegment(const Mode &md, int numCh, const std::vector<bool> &dt) :
mode(md), mode(md),
numChars(numCh), numChars(numCh),
data(dt) { data(dt) {
@ -165,7 +165,7 @@ QrSegment::QrSegment(Mode md, int numCh, const std::vector<bool> &dt) :
} }
QrSegment::QrSegment(Mode md, int numCh, std::vector<bool> &&dt) : QrSegment::QrSegment(const Mode &md, int numCh, std::vector<bool> &&dt) :
mode(md), mode(md),
numChars(numCh), numChars(numCh),
data(std::move(dt)) { data(std::move(dt)) {

@ -170,7 +170,7 @@ class QrSegment final {
* The character count (numCh) must agree with the mode and the bit buffer length, * 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. * but the constraint isn't checked. The given bit buffer is copied and stored.
*/ */
public: QrSegment(Mode md, int numCh, const std::vector<bool> &dt); public: QrSegment(const Mode &md, int numCh, const std::vector<bool> &dt);
/* /*
@ -178,7 +178,7 @@ class QrSegment final {
* The character count (numCh) must agree with the mode and the bit buffer length, * 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. * but the constraint isn't checked. The given bit buffer is moved and stored.
*/ */
public: QrSegment(Mode md, int numCh, std::vector<bool> &&dt); public: QrSegment(const Mode &md, int numCh, std::vector<bool> &&dt);
/*---- Methods ----*/ /*---- Methods ----*/

Loading…
Cancel
Save