[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5507] Improve copy ctor and assignment and equality opera
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5507] Improve copy ctor and assignment and equality operators (VS) |
Date: |
Sat, 23 Jun 2012 22:34:17 +0000 |
Revision: 5507
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5507
Author: chicares
Date: 2012-06-23 22:34:17 +0000 (Sat, 23 Jun 2012)
Log Message:
-----------
Improve copy ctor and assignment and equality operators (VS)
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/input.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2012-06-23 22:33:42 UTC (rev 5506)
+++ lmi/trunk/ChangeLog 2012-06-23 22:34:17 UTC (rev 5507)
@@ -30355,3 +30355,14 @@
Expunge a disused member function: xml input, unlike binary, is easily
differenced with external tools.
+20120623T2233Z <address@hidden> [578]
+
+ input_test.cpp
+Measure speed of copy ctor and assignment and equality operators.
+
+20120623T2234Z <address@hidden> [573]
+
+ input.cpp
+Improve copy ctor and assignment and equality operators (VS). See:
+ http://lists.nongnu.org/archive/html/lmi/2012-03/msg00014.html
+
Modified: lmi/trunk/input.cpp
===================================================================
--- lmi/trunk/input.cpp 2012-06-23 22:33:42 UTC (rev 5506)
+++ lmi/trunk/input.cpp 2012-06-23 22:34:17 UTC (rev 5507)
@@ -254,17 +254,7 @@
,MemberSymbolTable <Input>()
{
AscribeMembers();
- std::vector<std::string>::const_iterator i;
- for(i = member_names().begin(); i != member_names().end(); ++i)
- {
- // This would be wrong:
- // operator[](*i) = z[*i];
- // because it would swap in a copy of z's *members*.
- //
- // TODO ?? Would we be better off without the operator=() that
- // does that? Using str() here, passim, seems distateful.
- operator[](*i) = z[*i].str();
- }
+ MemberSymbolTable<Input>::assign(z);
DoAdaptExternalities();
}
@@ -274,37 +264,14 @@
Input& Input::operator=(Input const& z)
{
- std::vector<std::string>::const_iterator i;
- for(i = member_names().begin(); i != member_names().end(); ++i)
- {
- operator[](*i) = z[*i].str();
- }
+ MemberSymbolTable<Input>::assign(z);
DoAdaptExternalities();
return *this;
}
-// TODO ?? Can this be put into class MemberSymbolTable?
bool Input::operator==(Input const& z) const
{
- std::vector<std::string>::const_iterator i;
- for(i = member_names().begin(); i != member_names().end(); ++i)
- {
-// TODO ?? Provide operator!=(). Done yet?
-// if(operator[](*i) != z[*i])
-// TODO ?? Wait--this wouldn't work, at least not yet...
-// ...it tests *identity*, not *equivalence*.
-// if(!(operator[](*i) == z[*i]))
-//
-// TODO ?? Then why doesn't even this work?
-// if(!(operator[](*i).str() == z[*i].str()))
- std::string const s0 = operator[](*i).str();
- std::string const s1 = z[*i].str();
- if(s0 != s1)
- {
- return false;
- }
- }
- return true;
+ return MemberSymbolTable<Input>::equals(z);
}
mcenum_ledger_type Input::ledger_type () const {return GleanedLedgerType_;}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5507] Improve copy ctor and assignment and equality operators (VS),
Greg Chicares <=