Click here to Skip to main content
15,845,744 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Applicatin as TrayIcon? Pin
Benoy Bose31-May-06 22:42
Benoy Bose31-May-06 22:42 
AnswerRe: Applicatin as TrayIcon? Pin
Hamid_RT31-May-06 22:47
Hamid_RT31-May-06 22:47 
GeneralRe: Applicatin as TrayIcon? Pin
bosfan1-Jun-06 4:08
bosfan1-Jun-06 4:08 
Questionhow to compute set intersection efficiently? Pin
George_George31-May-06 22:18
George_George31-May-06 22:18 
AnswerRe: how to compute set intersection efficiently? Pin
David Crow1-Jun-06 5:58
David Crow1-Jun-06 5:58 
GeneralRe: how to compute set intersection efficiently? Pin
George_George1-Jun-06 19:41
George_George1-Jun-06 19:41 
GeneralRe: how to compute set intersection efficiently? Pin
David Crow2-Jun-06 3:51
David Crow2-Jun-06 3:51 
AnswerRe: how to compute set intersection efficiently? [modified] Pin
Stephen Hewitt1-Jun-06 15:20
Stephen Hewitt1-Jun-06 15:20 
Use STL. The following calculates a set intersection:
Here's a complete example I had laying around:
----------------------------------------------

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;

const char* g_Names1[] = {"Joe", "Paul", "Simon", "Steve", "Karl"};
const char** g_Names1Begin = &g_Names1[0];
const char** g_Names1End = &g_Names1[sizeof(g_Names1)/sizeof(g_Names1[0])];

const char* g_Names2[] = {"Paul", "Kate", "Oleg"};
const char** g_Names2Begin = &g_Names2[0];
const char** g_Names2End = &g_Names2[sizeof(g_Names2)/sizeof(g_Names2[0])];

struct CharLess
{
bool operator()(const char* p1, const char* p2) const
{
return strcmp(p1, p2)<0;
}
};

int main(int argc, char* argv[])
{
typedef vector<const char*> VEC;

VEC v1(g_Names1Begin, g_Names1End);
VEC v2(g_Names2Begin, g_Names2End);

sort(v1.begin(), v1.end(), CharLess());
sort(v2.begin(), v2.end(), CharLess());
set_intersection(
v1.begin(), v1.end(),
v2.begin(), v2.end(),
ostream_iterator<const char*>(cout, "\n"),
CharLess()
);

return 0;
}


Steve
GeneralRe: how to compute set intersection efficiently? [modified] Pin
George_George1-Jun-06 19:45
George_George1-Jun-06 19:45 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
Stephen Hewitt1-Jun-06 19:54
Stephen Hewitt1-Jun-06 19:54 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
George_George1-Jun-06 20:06
George_George1-Jun-06 20:06 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
Stephen Hewitt1-Jun-06 20:21
Stephen Hewitt1-Jun-06 20:21 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
George_George1-Jun-06 21:13
George_George1-Jun-06 21:13 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
Stephen Hewitt1-Jun-06 21:17
Stephen Hewitt1-Jun-06 21:17 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
Stephen Hewitt1-Jun-06 19:57
Stephen Hewitt1-Jun-06 19:57 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
George_George1-Jun-06 20:09
George_George1-Jun-06 20:09 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
Stephen Hewitt1-Jun-06 20:22
Stephen Hewitt1-Jun-06 20:22 
GeneralRe: how to compute set intersection efficiently? [modified] Pin
George_George1-Jun-06 21:16
George_George1-Jun-06 21:16 
QuestionLast Window Message [modified] Pin
HakunaMatada31-May-06 22:12
HakunaMatada31-May-06 22:12 
AnswerRe: Last Window Message Pin
Michael Dunn31-May-06 22:13
sitebuilderMichael Dunn31-May-06 22:13 
GeneralRe: Last Window Message Pin
HakunaMatada31-May-06 22:18
HakunaMatada31-May-06 22:18 
QuestionVisual C++.NET and VS C++ 6.0, are they the same? Pin
DzungLean31-May-06 22:07
DzungLean31-May-06 22:07 
AnswerRe: Visual C++.NET and VS C++ 6.0, are they the same? Pin
Michael Dunn31-May-06 22:12
sitebuilderMichael Dunn31-May-06 22:12 
AnswerRe: Visual C++.NET and VS C++ 6.0, are they the same? Pin
toxcct1-Jun-06 0:04
toxcct1-Jun-06 0:04 
AnswerRe: Visual C++.NET and VS C++ 6.0, are they the same? Pin
William.Wang1-Jun-06 0:09
William.Wang1-Jun-06 0:09 

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.