I'm trying to use istream_iterators to read from a file and put words into a set<word>. Word is a class that I've defined that takes a string and removes all non-letters such as punctuation. When I compile I get a really disgusting looking error. Any help? I'm using the newest DJGPP if that helps at all.
Error:Code:set<word> Words; set<word>::iterator it=Words.begin(); std::copy(std::istream_iterator<string>(fin),std::istream_iterator<string>(),std::inserter(Words,it));
c:/djgpp/lang/cxx/3.32/bits/stl_function.h: In member function `bool
std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = word]':
c:/djgpp/lang/cxx/3.32/bits/stl_tree.h:1066: instantiated from `std::_Rb_tree_
iterator<_Val, _Val&, _Val*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _A
lloc>::insert_unique(std::_Rb_tree_iterator<_Val, _Val&, _Val*>, const _Val&) [w
ith _Key = word, _Val = word, _KeyOfValue = std::_Identity<word>, _Compare = std
::less<word>, _Alloc = std::allocator<word>]'
c:/djgpp/lang/cxx/3.32/bits/stl_set.h:160: instantiated from `typename std::_R
b_tree<_Key, _Key, std::_Identity<_Key>, _Compare, _Alloc>::const_iterator std::
set<_Key, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, _Key, std::_Ide
ntity<_Key>, _Compare, _Alloc>::const_iterator, const _Key&) [with _Key = word,
_Compare = std::less<word>, _Alloc = std::allocator<word>]'
c:/djgpp/lang/cxx/3.32/bits/stl_iterator.h:524: instantiated from `std::insert
_iterator<_Container>& std::insert_iterator<_Container>::operator=(typena me _Con
tainer::const_reference) [with _Container = std::set<word, std::less<word>, std:
:allocator<word> >]'
c:/djgpp/lang/cxx/3.32/bits/stlalgobase.h:228: instantiated from `_OutputIter
std::__copy(_InputIter, _InputIter, _OutputIter, std::input_iterator_tag) [with
_InputIter = std::istream_iterator<std::string, char, std::char_traits<char>, pt
rdiff_t>, _OutputIter = std::insert_iterator<std::set<word, std::less<word>, std
::allocator<word> > >]'
c:/djgpp/lang/cxx/3.32/bits/stlalgobase.h:260: instantiated from `_OutputIter
std::__copy_aux2(_InputIter, _InputIter, _OutputIter, __false_type) [with _Input
Iter = std::istream_iterator<std::string, char, std::char_traits<char>, ptrdiff_
t>, _OutputIter = std::insert_iterator<std::set<word, std::less<word>, std::allo
cator<word> > >]'
c:/djgpp/lang/cxx/3.32/bits/stlalgobase.h:303: instantiated from `_OutputIter
std::__copy_ni2(_InputIter, _InputIter, _OutputIter, __false_type) [with _InputI
ter = std::istream_iterator<std::string, char, std::char_traits<char>, ptrdiff_t
>, _OutputIter = std::insert_iterator<std::set<word, std::less<word>, std::alloc
ator<word> > >]'
c:/djgpp/lang/cxx/3.32/bits/stlalgobase.h:323: instantiated from `_OutputIter
std::__copy_ni1(_InputIter, _InputIter, _OutputIter, __false_type) [with _InputI
ter = std::istream_iterator<std::string, char, std::char_traits<char>, ptrdiff_t
>, _OutputIter = std::insert_iterator<std::set<word, std::less<word>, std::alloc
ator<word> > >]'
c:/djgpp/lang/cxx/3.32/bits/stlalgobase.h:349: instantiated from `_OutputIter
std::copy(_InputIter, _InputIter, _OutputIter) [with _InputIter = std::istream_i
terator<std::string, char, std::char_traits<char>, ptrdiff_t>, _OutputIter = std
::insert_iterator<std::set<word, std::less<word>, std::allocator<word> > >]'
biblio.cpp:30: instantiated from here
c:/djgpp/lang/cxx/3.32/bits/stl_function.h:197: error: passing `const word' as
`this' argument of `bool word::operator<(word)' discards qualifiers