lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 894b5ad 3/5: Copy private data in operator=()


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 894b5ad 3/5: Copy private data in operator=()
Date: Thu, 15 Mar 2018 14:14:26 -0400 (EDT)

branch: master
commit 894b5ad9af08a89eb38e9c338f77d0b1eac0b340
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Copy private data in operator=()
    
    Apparently this latent error has never manifested itself because only
    unscaled ledgers have ever actually been copied or assigned.
---
 ledger_base.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ledger_base.cpp b/ledger_base.cpp
index fecdba1..205413a 100644
--- a/ledger_base.cpp
+++ b/ledger_base.cpp
@@ -55,6 +55,8 @@ LedgerBase& LedgerBase::operator=(LedgerBase const& obj)
 {
     if(this != &obj)
         {
+        scale_factor_ = obj.scale_factor_;
+        scale_unit_   = obj.scale_unit_;
         Initialize(obj.GetLength());
         Copy(obj);
         }
@@ -101,6 +103,9 @@ void LedgerBase::Copy(LedgerBase const& obj)
     // Rather, their contents are information that is added in by derived
     // classes.
     //
+    // scale_factor_ and scale_unit_ aren't copied here because they're
+    // copied explicitly by the caller.
+    //
     // TODO ?? There has to be a way to abstract this.
 
     double_vector_map::const_iterator obj_svmi = obj.AllVectors.begin();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]