Skip to content

Commit b8a3d0b

Browse files
authored
Merge pull request #31 from stbergmann/char_traits
There is no `std::basic_string<int>`
2 parents 3194890 + 92c6ea8 commit b8a3d0b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dict-generate.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
**********************************************************************************/
2424

25+
#include <algorithm>
2526
#include <iostream>
2627
#include <string>
2728
#include <fstream>
@@ -387,7 +388,7 @@ typedef map<string, Entry> EntryMap_t;
387388
typedef list<string> StringList_t;
388389
typedef list<NodeSPtr> NodeList_t;
389390
typedef set<StringInt> StringIntSet_t;
390-
typedef basic_string<int> StringOfInts;
391+
typedef vector<int> StringOfInts;
391392
typedef vector<unsigned int> UintVect;
392393
typedef vector<uint64_t> Uint64Vect;
393394
typedef vector<StringInt *> StrIntPtrVect_t;
@@ -864,15 +865,14 @@ void CreateArrays(NodeSPtr Root, StringIntSet_t & StrSet, StringOfInts & ChildAd
864865
for(Itc = Root->ChildBegin(); Itc != Root->ChildEnd(); ++Itc)
865866
{
866867
int i = Itc->second->GetAddr();
867-
Chld += i;
868+
Chld.push_back(i);
868869
}
869870
// Find where in pointer array the child pointer string is
870-
StringOfInts::size_type x = ChildAddrs.find(Chld);
871-
if (x == StringOfInts::npos)
871+
StringOfInts::size_type x = search(ChildAddrs.begin(), ChildAddrs.end(), Chld.begin(), Chld.end()) - ChildAddrs.begin();
872+
if (x == ChildAddrs.size())
872873
{
873874
// Not found, add it
874-
x = ChildAddrs.length();
875-
ChildAddrs += Chld;
875+
ChildAddrs.insert(ChildAddrs.end(), Chld.begin(), Chld.end());
876876
}
877877
// Val will contain the final node data
878878
uint64_t Val = Its->i;

0 commit comments

Comments
 (0)