Click here to Skip to main content
15,916,600 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionHow to start the exe server in hide mode or another desktop? Pin
kcynic6-Dec-09 19:05
kcynic6-Dec-09 19:05 
AnswerRe: How to start the exe server in hide mode or another desktop? Pin
«_Superman_»7-Dec-09 9:27
professional«_Superman_»7-Dec-09 9:27 
GeneralRe: How to start the exe server in hide mode or another desktop? Pin
kcynic7-Dec-09 14:14
kcynic7-Dec-09 14:14 
QuestionHow to get full path of sepcied file Pin
am 20095-Dec-09 19:44
am 20095-Dec-09 19:44 
AnswerRe: How to get full path of sepcied file Pin
Jonathan Davies6-Dec-09 8:23
Jonathan Davies6-Dec-09 8:23 
QuestionI need to Resize ATL dialog based on the screen resolution Pin
Member 33037924-Dec-09 1:08
Member 33037924-Dec-09 1:08 
AnswerRe: I need to Resize ATL dialog based on the screen resolution Pin
Alain Rist21-Dec-09 13:00
Alain Rist21-Dec-09 13:00 
QuestionCreating sidebar for windows media player (similar to iTunes) Pin
smitha s4-Dec-09 0:27
smitha s4-Dec-09 0:27 
Questionre: probelms erasing a multimap entry Pin
Alan Kurlansky2-Dec-09 11:08
Alan Kurlansky2-Dec-09 11:08 
AnswerRe: re: probelms erasing a multimap entry [modified] Pin
kcynic2-Dec-09 18:42
kcynic2-Dec-09 18:42 
QuestionAdd event handler functions from ActiveX to VC++6.0 ATL Project Pin
jensreichert1-Dec-09 23:44
jensreichert1-Dec-09 23:44 
AnswerRe: Add event handler functions from ActiveX to VC++6.0 ATL Project Pin
Garth J Lancaster2-Dec-09 0:28
professionalGarth J Lancaster2-Dec-09 0:28 
AnswerRe: Add event handler functions from ActiveX to VC++6.0 ATL Project Pin
Garth J Lancaster2-Dec-09 0:34
professionalGarth J Lancaster2-Dec-09 0:34 
GeneralRe: Add event handler functions from ActiveX to VC++6.0 ATL Project Pin
MESCO2-Mar-10 20:26
MESCO2-Mar-10 20:26 
Questionsorting an STL list of =references= to objects Pin
kerchunk1-Dec-09 12:39
kerchunk1-Dec-09 12:39 
AnswerRe: sorting an STL list of =references= to objects Pin
kerchunk1-Dec-09 14:44
kerchunk1-Dec-09 14:44 
I've improved my testcase to use two lists, one a list of structs and the original list of pointers-to-structs
and added some code to populate, list, sort, and list again both lists. The list-of-structs sorts correctly while the list-of-pointers-to-structs does not. So it's got to be something with the how the overloaded operators are set up. Any ideas on how to adjust them to work right?

[code]
// sort_example.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <list>
#include <iterator>
#include <vector>
#include <algorithm>

using namespace std;

struct pstchip_pin_wor {
string primitive;
string pin_name;
string pin_number;

/* optional constructors */
pstchip_pin_wor( string aa, string bb, string cc) {
primitive = aa;
pin_name = bb;
pin_number = cc;
}

//overridding operators
pstchip_pin_wor& pstchip_pin_wor::operator = (const pstchip_pin_wor &itemToCopy) {
this->primitive = itemToCopy.primitive;
this->pin_name = itemToCopy.pin_name;
this->pin_number = itemToCopy.pin_number;
return *this;
}

int pstchip_pin_wor::operator == ( const pstchip_pin_wor& itemToCompare) {
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name ) return 1;
return 0;
}

int pstchip_pin_wor::operator < ( const pstchip_pin_wor& itemToCompare) {
if( this->primitive < itemToCompare.primitive ) return 1;
if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name) return 1;
return 0;
}

};

//main function
int main(int argc, char* argv[]) {

int nRetCode = 0;

list<pstchip_pin_wor> rows_pstchip_pins;
list<pstchip_pin_wor*> wors_pstchip_pins;

//populate list
rows_pstchip_pins.push_back( pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
rows_pstchip_pins.push_back( pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );

wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Spain", "Madrid" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "USA", "Washington DC" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Canada", "Ottawa" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "Europe", "Germany", "Berlin" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "South America", "Brazil", "Sao Paulo" ) );
wors_pstchip_pins.push_back( new pstchip_pin_wor( "North America", "Mexico", "Mexico City" ) );

cout << "before sorting in list" << endl << endl;
for( list<pstchip_pin_wor>::iterator gh = rows_pstchip_pins.begin() ; gh != rows_pstchip_pins.end() ; gh++ ) {
cout << gh->primitive << "==" << gh->pin_name << "==" << gh->pin_number << endl;
}

rows_pstchip_pins.sort();

cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor>::iterator uy = rows_pstchip_pins.begin() ; uy != rows_pstchip_pins.end() ; uy++ ) {
cout << uy->primitive << "==" << uy->pin_name << "==" << uy->pin_number << endl;
}


cout << endl << endl << "before sorting using pointers in list" << endl << endl;
for( list<pstchip_pin_wor*>::iterator ka = wors_pstchip_pins.begin() ; ka != wors_pstchip_pins.end() ; ka++ ) {
cout << (*ka)->primitive << "==" << (*ka)->pin_name << "==" << (*ka)->pin_number << endl;
}

wors_pstchip_pins.sort();

cout << endl << "after sorting" << endl << endl;
for( list<pstchip_pin_wor*>::iterator zm = wors_pstchip_pins.begin() ; zm != wors_pstchip_pins.end() ; zm++ ) {
cout << (*zm)->primitive << "==" << (*zm)->pin_name << "==" << (*zm)->pin_number << endl;
}

return nRetCode;

} //end-function
[/code]
GeneralRe: sorting an STL list of =references= to objects Pin
Simple Inheritance1-Dec-09 16:48
Simple Inheritance1-Dec-09 16:48 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk1-Dec-09 20:56
kerchunk1-Dec-09 20:56 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk2-Dec-09 10:02
kerchunk2-Dec-09 10:02 
GeneralRe: sorting an STL list of =references= to objects [modified] Pin
Simple Inheritance2-Dec-09 10:48
Simple Inheritance2-Dec-09 10:48 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk3-Dec-09 19:42
kerchunk3-Dec-09 19:42 
GeneralRe: sorting an STL list of =references= to objects Pin
Simple Inheritance4-Dec-09 10:38
Simple Inheritance4-Dec-09 10:38 
GeneralRe: sorting an STL list of =references= to objects Pin
kerchunk6-Dec-09 9:03
kerchunk6-Dec-09 9:03 
QuestionHow to get clipping region of windowless activex? Pin
smalti1-Dec-09 9:15
smalti1-Dec-09 9:15 
QuestionError on using BMP image in LoadBitmap Pin
am 200926-Nov-09 0:47
am 200926-Nov-09 0:47 

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.