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(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()); }