diff options
author | 2017-01-26 21:22:59 +0100 | |
---|---|---|
committer | 2017-01-27 15:22:18 +0100 | |
commit | 6d2354264a7d92e1a1d9163eec9e2c9df239b159 (patch) | |
tree | 8021fd3d56893fbfce73be0ade97ef81bf94bd9b /src/lib/netlist/plib/putil.cpp | |
parent | 5c88873a8747b751994216e269128a6d26bd4a04 (diff) |
Do not derive other classes from std::vector. More cleanup. (nw)
Diffstat (limited to 'src/lib/netlist/plib/putil.cpp')
-rw-r--r-- | src/lib/netlist/plib/putil.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp index 7007c818384..87ac06b3f75 100644 --- a/src/lib/netlist/plib/putil.cpp +++ b/src/lib/netlist/plib/putil.cpp @@ -40,9 +40,10 @@ namespace plib } } - pstring_vector_t::pstring_vector_t(const pstring &str, const pstring &onstr, bool ignore_empty) - : std::vector<pstring>() + std::vector<pstring> psplit(const pstring &str, const pstring &onstr, bool ignore_empty) { + std::vector<pstring> ret; + pstring::iterator p = str.begin(); pstring::iterator pn = str.find(onstr, p); @@ -50,7 +51,7 @@ namespace plib { pstring t = str.substr(p, pn); if (!ignore_empty || t.len() != 0) - this->push_back(t); + ret.push_back(t); p = pn + onstr.len(); pn = str.find(onstr, p); } @@ -58,14 +59,15 @@ namespace plib { pstring t = str.substr(p, str.end()); if (!ignore_empty || t.len() != 0) - this->push_back(t); + ret.push_back(t); } + return ret; } - pstring_vector_t::pstring_vector_t(const pstring &str, const std::vector<pstring> &onstrl) - : std::vector<pstring>() + std::vector<pstring> psplit(const pstring &str, const std::vector<pstring> &onstrl) { pstring col = ""; + std::vector<pstring> ret; unsigned i = 0; while (i<str.blen()) @@ -82,10 +84,10 @@ namespace plib if (p != static_cast<std::size_t>(-1)) { if (col != "") - this->push_back(col); + ret.push_back(col); col = ""; - this->push_back(onstrl[p]); + ret.push_back(onstrl[p]); i += onstrl[p].blen(); } else @@ -96,7 +98,9 @@ namespace plib } } if (col != "") - this->push_back(col); + ret.push_back(col); + + return ret; } |