Macaulay2 Engine
Loading...
Searching...
No Matches

◆ subwordPosition()

bool WordTable::subwordPosition ( Word word1,
Word word2,
int & result_start_index )
staticprivate

Definition at line 59 of file WordTable.cpp.

66{
67 if (word2.size() < word1.size()) return false;
68 for (auto j = 0; j <= word2.size() - word1.size(); ++j)
69 {
70 bool match = true;
71 for (auto k = 0; k < word1.size(); ++k)
72 if (word1.begin()[k] != word2.begin()[j+k])
73 {
74 match = false;
75 break;
76 }
77 if (match)
78 {
79 result_start_index = j;
80 return true;
81 }
82 }
83 return false;
84}
const int * begin() const
Definition Word.hpp:72
int size() const
Definition Word.hpp:74

References Word::begin(), and Word::size().

Referenced by subword().