int main() { std::ifstream ifs("../data/book.txt"); StrBlob blob; for (std::string str; std::getline(ifs, str); ) blob.push_back(str); for (StrBlobPtr pbeg(blob.begin()), pend(blob.end()); pbeg != pend; pbeg.incr()) std::cout << pbeg.deref() << std::endl; }
int main() { ifstream input("file.txt"); StrBlob b; string s; while (getline(input, s)) b.push_back(s); for (auto it = b.begin(); neq(it, b.end()); it.incr()) cout << it.deref() << endl; return 0; }
int main() { string s; StrBlob a; while(cin >> s) { a.push_back(s); } StrBlobPtr sbpBegin = a.begin(); for(unsigned int c = 0; c != a.size();sbpBegin.incr()) { cout << sbpBegin.deref() << endl; ++c; } return 0; }
int main() { ifstream in("ex20.cpp"); StrBlob text; string line; while (in >> line) text.push_back(line); StrBlobPtr ptr = text.begin(); size_t curr = 0; while (curr != text.size()) { cout << ptr.deref() << ' '; ptr.incr(); ++curr; } return 0; }
int main(int argc, char const *argv[]) { StrBlob str; string word; while( cin >> word) { str.push_back(word); } for(auto it = str.begin(); it != str.end(); ++it ) { cout << *it << " "; } cout << endl; StrBlobPtr strPtr(str); return 0; }
bool operator<(const StrBlob & lhs, const StrBlob & rhs) { return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); }