Click here to Skip to main content
15,897,371 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
Roger Stoltz23-Apr-09 21:37
Roger Stoltz23-Apr-09 21:37 
AnswerRe: Calling a COM DLL(built in visual studio 2008) from a COM DLL VC++ (visual studio 6.0) Pin
rana ray24-Apr-09 4:57
rana ray24-Apr-09 4:57 
QuestionHow to retrieve the Windows media player's interface point where the WMP is embeded in web page. Pin
zhaoyu16222-Apr-09 19:30
zhaoyu16222-Apr-09 19:30 
QuestionHow to Convert String Array to LPWSTR* Pin
ANURAG VISHNOI22-Apr-09 18:43
ANURAG VISHNOI22-Apr-09 18:43 
AnswerRe: How to Convert String Array to LPWSTR* Pin
Stuart Dootson22-Apr-09 21:26
professionalStuart Dootson22-Apr-09 21:26 
GeneralRe: How to Convert String Array to LPWSTR* [modified] Pin
ANURAG VISHNOI22-Apr-09 23:33
ANURAG VISHNOI22-Apr-09 23:33 
QuestionSTL-set difference and intersection Pin
liquid_21-Apr-09 23:03
liquid_21-Apr-09 23:03 
AnswerRe: STL-set difference and intersection Pin
Stuart Dootson22-Apr-09 5:39
professionalStuart Dootson22-Apr-09 5:39 
Use std::inserter[^] or std::back_inserter[^] for the output iterator. That causes the items to be inserted into the container without having to know what size it should be before you've constructed it.

If you're using a vector or list as the output, I'd use std::back_inserter. For a set, std::inserter is required. Here's an example:

#include <vector>
#include <set>
#include <iostream>
#include <algorithm>
#include <iterator>

int main()
{
   std::set<int> a, b, c;
   a.insert(1);
   a.insert(2);
   a.insert(3);
   a.insert(4);
   b.insert(2);
   b.insert(4);
   b.insert(5);
   b.insert(7);
   std::vector<int> d;

   std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(c, c.end()));
   std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(d));
   
   std::copy(c.begin(), c.end(), std::ostream_iterator<int>(std::cout, " "));
   std::copy(d.begin(), d.end(), std::ostream_iterator<int>(std::cout, " "));
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: STL-set difference and intersection - works! Pin
liquid_22-Apr-09 21:15
liquid_22-Apr-09 21:15 
Questionconvertion vc6 to dotnet2008 Pin
Rajeesh MP17-Apr-09 2:37
Rajeesh MP17-Apr-09 2:37 
AnswerRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson17-Apr-09 9:08
professionalStuart Dootson17-Apr-09 9:08 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP17-Apr-09 18:44
Rajeesh MP17-Apr-09 18:44 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson17-Apr-09 19:07
professionalStuart Dootson17-Apr-09 19:07 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP17-Apr-09 19:44
Rajeesh MP17-Apr-09 19:44 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson17-Apr-09 21:22
professionalStuart Dootson17-Apr-09 21:22 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP18-Apr-09 0:50
Rajeesh MP18-Apr-09 0:50 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson18-Apr-09 1:19
professionalStuart Dootson18-Apr-09 1:19 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP21-Apr-09 0:59
Rajeesh MP21-Apr-09 0:59 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson21-Apr-09 2:00
professionalStuart Dootson21-Apr-09 2:00 
GeneralRe: convertion vc6 to dotnet2008 [modified] Pin
Rajeesh MP21-Apr-09 18:10
Rajeesh MP21-Apr-09 18:10 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson21-Apr-09 22:03
professionalStuart Dootson21-Apr-09 22:03 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP22-Apr-09 18:23
Rajeesh MP22-Apr-09 18:23 
GeneralRe: convertion vc6 to dotnet2008 Pin
Rajeesh MP22-Apr-09 19:05
Rajeesh MP22-Apr-09 19:05 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson22-Apr-09 21:15
professionalStuart Dootson22-Apr-09 21:15 
GeneralRe: convertion vc6 to dotnet2008 Pin
Stuart Dootson22-Apr-09 21:00
professionalStuart Dootson22-Apr-09 21:00 

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.