Click here to Skip to main content
15,920,383 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Services on 98 Pin
Nick Blumhardt10-Feb-03 19:17
Nick Blumhardt10-Feb-03 19:17 
GeneralRe: What is the difference between delete[] and delete? Pin
Joaquín M López Muñoz10-Feb-03 2:24
Joaquín M López Muñoz10-Feb-03 2:24 
GeneralRe: What is the difference between delete[] and delete? Pin
George210-Feb-03 2:35
George210-Feb-03 2:35 
GeneralRe: What is the difference between delete[] and delete? Pin
Joaquín M López Muñoz10-Feb-03 2:44
Joaquín M López Muñoz10-Feb-03 2:44 
GeneralRe: What is the difference between delete[] and delete? Pin
George210-Feb-03 3:00
George210-Feb-03 3:00 
GeneralRe: What is the difference between delete[] and delete? Pin
Joaquín M López Muñoz10-Feb-03 3:49
Joaquín M López Muñoz10-Feb-03 3:49 
GeneralRe: What is the difference between delete[] and delete? Pin
George210-Feb-03 18:02
George210-Feb-03 18:02 
GeneralSTL remove_copy_if is not working properly Pin
George210-Feb-03 1:15
George210-Feb-03 1:15 
Hi, everyone!

Here is my simple STL program, it is a spell-checker.
The program copy every word of text to output
that is not in the dictionary. I have added all the source
codes and error messages below. My IDE is VC6.0.
I put "abc 123 def" in c:\\dict.txt and "123 345" in c:\\words.txt.
The output should be 345, but now the output is 123 345.

Who can tell me where the error is?

Source Codes:

--------
#pragma warning(disable : 4786)

#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <fstream>
#include <string>

using namespace std;

template <class bidirectional_iterator, class T>
class nonAssocFinder {
public:
nonAssocFinder(bidirectional_iterator begin,
bidirectional_iterator end) :
_begin(begin), _end(end) {}

bool operator() (const T& word) {
cout << binary_search(_begin, _end, word);
return binary_search(_begin, _end, word); }

private:
bidirectional_iterator _begin;
bidirectional_iterator _end;
};


void main()
{
typedef vector<string> dict_type;

ifstream dictFile("c:\\dict.txt");
ifstream wordsFile("c:\\words.txt");

dict_type dictionary;

copy (istream_iterator<string>(dictFile),
istream_iterator<string>(),
back_inserter(dictionary));

remove_copy_if (
istream_iterator<string>(wordsFile),
istream_iterator<string>(),
ostream_iterator<string>(cout, "\n"),
nonAssocFinder<dict_type::iterator,
dict_type::value_type>
(dictionary.begin(), dictionary.end()));
}
--------


Thanks in advance,
George
GeneralRe: STL remove_copy_if is not working properly Pin
Joaquín M López Muñoz10-Feb-03 9:29
Joaquín M López Muñoz10-Feb-03 9:29 
GeneralRe: STL remove_copy_if is not working properly Pin
George210-Feb-03 18:00
George210-Feb-03 18:00 
GeneralCompiling error on my simple STL spell-checker. Pin
George29-Feb-03 2:39
George29-Feb-03 2:39 
GeneralRe: Compiling error on my simple STL spell-checker. Pin
Joaquín M López Muñoz9-Feb-03 11:23
Joaquín M López Muñoz9-Feb-03 11:23 
GeneralRe: Compiling error on my simple STL spell-checker. Pin
George210-Feb-03 1:10
George210-Feb-03 1:10 
GeneralManta Web ATL Sample. Pin
Bo Hunter7-Feb-03 11:14
Bo Hunter7-Feb-03 11:14 
GeneralRe: Manta Web ATL Sample. Pin
TigerNinja_19-Feb-03 3:18
TigerNinja_19-Feb-03 3:18 
Generalresume download Pin
Anonymous6-Feb-03 17:34
Anonymous6-Feb-03 17:34 
GeneralRe: resume download Pin
JoeSox6-Feb-03 19:02
JoeSox6-Feb-03 19:02 
GeneralRe: resume download Pin
AlexO7-Feb-03 3:05
AlexO7-Feb-03 3:05 
GeneralRe: resume download Pin
Todd Smith19-Feb-03 9:29
Todd Smith19-Feb-03 9:29 
Generaloutlook express configuration Pin
naradaji6-Feb-03 5:25
naradaji6-Feb-03 5:25 
GeneralRe: outlook express configuration Pin
Michael Dunn6-Feb-03 9:43
sitebuilderMichael Dunn6-Feb-03 9:43 
GeneralRe: outlook express configuration Pin
naradaji6-Feb-03 21:13
naradaji6-Feb-03 21:13 
GeneralRe: outlook express configuration Pin
Michael Dunn8-Feb-03 19:09
sitebuilderMichael Dunn8-Feb-03 19:09 
GeneralRe: outlook express configuration Pin
naradaji9-Feb-03 21:22
naradaji9-Feb-03 21:22 
GeneralProblems connecting DWebBrowserEvents2 Pin
Xavyer5-Feb-03 22:43
Xavyer5-Feb-03 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.