Click here to Skip to main content
15,886,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to get computer color setting? Pin
includeh1015-Jan-11 20:37
includeh1015-Jan-11 20:37 
AnswerRe: How to get computer color setting? Pin
Andrew Brock15-Jan-11 20:53
Andrew Brock15-Jan-11 20:53 
GeneralRe: How to get computer color setting? Pin
includeh1016-Jan-11 2:47
includeh1016-Jan-11 2:47 
GeneralRe: How to get computer color setting? Pin
Andrew Brock16-Jan-11 2:51
Andrew Brock16-Jan-11 2:51 
QuestionSorting data using std::map or std::multimap Pin
cmacgowan15-Jan-11 14:19
cmacgowan15-Jan-11 14:19 
AnswerRe: Sorting data using std::map or std::multimap Pin
Andrew Brock15-Jan-11 18:08
Andrew Brock15-Jan-11 18:08 
GeneralRe: Sorting data using std::map or std::multimap Pin
cmacgowan16-Jan-11 11:01
cmacgowan16-Jan-11 11:01 
AnswerRe: Sorting data using std::map or std::multimap Pin
Aescleal16-Jan-11 6:10
Aescleal16-Jan-11 6:10 
I'm not 100% sure what you're driving at but it looks as if you only want to use a map so you can synthesise a key and then use that to control the sort. The traditional way (at least in C++) to force a sort order in a collection is to implement operator< for the key (in a map) or the value (in a vector) that you're storing.

So if you've got a class with your contact lens data in try something like:

//contact_lens_data.h

class contact_lens_data
{
    // All the funkiness that's fit to print about contact lenses

    friend bool operator< (const contact_lens_data &left, const contact_lens_data &right );
};

//contact_lens_data.cpp

bool operator< (const contact_lens_data &left, const contact_lens_data &right )
{
    // Put the comparison in here, if left should appear towards the front of the sort order return true
}


Then you can store them in any collection and get the collation order you want using std::sort or the inserter for std::map.

Cheers,

Ash
GeneralRe: Sorting data using std::map or std::multimap Pin
cmacgowan16-Jan-11 11:02
cmacgowan16-Jan-11 11:02 
QuestionSoftware Keyboard Simulator Pin
RedDragon2k15-Jan-11 4:48
RedDragon2k15-Jan-11 4:48 
AnswerRe: Software Keyboard Simulator Pin
jschell15-Jan-11 10:02
jschell15-Jan-11 10:02 
AnswerRe: Software Keyboard Simulator Pin
Andrew Brock15-Jan-11 17:16
Andrew Brock15-Jan-11 17:16 
AnswerRe: Software Keyboard Simulator Pin
loyal ginger15-Jan-11 17:25
loyal ginger15-Jan-11 17:25 
GeneralRe: Software Keyboard Simulator Pin
RedDragon2k16-Jan-11 4:11
RedDragon2k16-Jan-11 4:11 
QuestionHow to Set Position where a Window will be minimised Pin
SoftwareDeveloperGoa15-Jan-11 4:42
SoftwareDeveloperGoa15-Jan-11 4:42 
AnswerRe: How to Set Position where a Window will be minimised Pin
Emilio Garavaglia15-Jan-11 7:09
Emilio Garavaglia15-Jan-11 7:09 
GeneralRe: How to Set Position where a Window will be minimised Pin
SoftwareDeveloperGoa15-Jan-11 7:17
SoftwareDeveloperGoa15-Jan-11 7:17 
GeneralRe: How to Set Position where a Window will be minimised Pin
Emilio Garavaglia15-Jan-11 8:52
Emilio Garavaglia15-Jan-11 8:52 
GeneralRe: How to Set Position where a Window will be minimised Pin
SoftwareDeveloperGoa15-Jan-11 9:01
SoftwareDeveloperGoa15-Jan-11 9:01 
QuestionWhat wrong with this loop? Pin
Le@rner14-Jan-11 19:34
Le@rner14-Jan-11 19:34 
AnswerRe: What wrong with this loop? Pin
Andrew Brock14-Jan-11 21:10
Andrew Brock14-Jan-11 21:10 
AnswerRe: What wrong with this loop? Pin
jixuduxing14-Jan-11 22:37
jixuduxing14-Jan-11 22:37 
GeneralRe: What wrong with this loop? Pin
Andrew Brock14-Jan-11 23:39
Andrew Brock14-Jan-11 23:39 
AnswerRe: What wrong with this loop? Pin
cp987614-Jan-11 23:49
cp987614-Jan-11 23:49 
AnswerRe: What wrong with this loop? Pin
Richard MacCutchan15-Jan-11 0:02
mveRichard MacCutchan15-Jan-11 0:02 

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.