M
Mike Wahler
David Rubin said:Mike Wahler wrote:
[snip]template <typename InsertIter>
void tokenize(const std::string& buf,
const std::string& delim,
InsertIter& ii)
[snip]
int main()
{
std::string buf("We* are/parsing [a---string");
std::string delim(" */[-");
std::deque<std::string> tokens;
tokenize(buf, delim, std::inserter(tokens, tokens.begin()));
This only works with my compiler if I do
std::insert_iterator<std::deque<std::string> > ii(tokens,
tokens.begin());
But you *did* get it to work with the reference parameter
for the iterator, right?
Interesting about having to 'spell it out' like that.
Both ways worked for me, (I also tried 'std::back_inserter' and
std::back_insert_iterator, both of which also worked for me as well).
tokenize(buf, delim, ii);
Otherwise, I get the same errors as before. I guess this means my
compiler is broken?
Seems so to me. Have you checked for a newer version
of g++?
-Mike