Keep a text editor open for composing your posts.
The body of your loop is wrong as well, but I cannot figure out what you had in mind when you wrote it. Doubly linked lists do not allow for random access, or even faster than linear time access, so operator[] is not overloaded for std::list. Consequently, it makes sense to use iterators here, e.g.,
Code:
#include <list>
#include <string>
#include <iostream>
int main()
{
std::list<std::string> keywords;
keywords.push_back("GET"); // To grab columns from tables
keywords.push_back("FROM"); // To grab tables
keywords.push_back("JOIN"); // To Join other tables
keywords.push_back("WHERE"); // To find if a certain column contains a certain value
keywords.push_back("SET"); // To set columns to certain values
keywords.push_back("UNION"); // To cluster our GET clauses
for (std::list<std::string>::iterator i = keywords.begin(), end = keywords.end();
i != end; ++i)
{
std::cout << *i << std::endl;
}
}
You need to start reading and thinking instead of just doing guess and check.