diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-08-04 00:25:49 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-08-04 00:25:49 -0400 |
commit | 9166952a1e2571bf5656345d7f8f1d1246e033d7 (patch) | |
tree | 81715eab307797c498c1a1f56671f480e3b14eaf /Carpet/CarpetLib/src/th.cc | |
parent | dbe1636f5ed6ec4859719ff08f731735e123c59e (diff) |
CarpetLib: Store registered gh, dh, th, gf, data etc. via sets, not via lists
Use set instead of list to store registered gh, dh, th, gf, data.
Do not store an iterator as handle for de-registering.
This corrects some memory corruption with the Intel compiler; the previous code may have been illegal.
Diffstat (limited to 'Carpet/CarpetLib/src/th.cc')
-rw-r--r-- | Carpet/CarpetLib/src/th.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Carpet/CarpetLib/src/th.cc b/Carpet/CarpetLib/src/th.cc index 9817e77bb..33c748e51 100644 --- a/Carpet/CarpetLib/src/th.cc +++ b/Carpet/CarpetLib/src/th.cc @@ -14,7 +14,7 @@ using namespace std; -list<th*> th::allth; +set<th*> th::allth; @@ -27,8 +27,8 @@ th::th (gh& h_, timelevels(0) { reffacts.resize(1, 1); - allthi = allth.insert(allth.end(), this); - gh_handle = h.add(this); + allth.insert(this); + h.insert(this); } th::th (gh& h_, int const timelevels_, vector<int> const& reffacts_, @@ -44,15 +44,15 @@ th::th (gh& h_, int const timelevels_, vector<int> const& reffacts_, assert (reffacts.AT(n) >= reffacts.AT(n-1)); assert (reffacts.AT(n) % reffacts.AT(n-1) == 0); } - allthi = allth.insert(allth.end(), this); - gh_handle = h.add(this); + allth.insert(this); + h.insert(this); } // Destructors th::~th () { - h.erase(gh_handle); - allth.erase(allthi); + h.erase(this); + allth.erase(this); } // Modifiers @@ -187,7 +187,7 @@ th:: allmemory () { size_t mem = memoryof(allth); - for (list<th*>::const_iterator + for (set<th*>::const_iterator thi = allth.begin(); thi != allth.end(); ++ thi) { mem += memoryof(**thi); |