Click here to Skip to main content
15,904,652 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionx86 and x64 code performance in 64 bit w7 Pin
Chesnokov Yuriy18-Jan-11 22:24
professionalChesnokov Yuriy18-Jan-11 22:24 
AnswerRe: x86 and x64 code performance in 64 bit w7 Pin
Emilio Garavaglia18-Jan-11 22:47
Emilio Garavaglia18-Jan-11 22:47 
GeneralRe: x86 and x64 code performance in 64 bit w7 Pin
Chesnokov Yuriy18-Jan-11 23:57
professionalChesnokov Yuriy18-Jan-11 23:57 
GeneralRe: x86 and x64 code performance in 64 bit w7 Pin
Emilio Garavaglia19-Jan-11 2:48
Emilio Garavaglia19-Jan-11 2:48 
GeneralRe: x86 and x64 code performance in 64 bit w7 Pin
Chesnokov Yuriy19-Jan-11 3:04
professionalChesnokov Yuriy19-Jan-11 3:04 
AnswerRe: x86 and x64 code performance in 64 bit w7 Pin
Andrew Brock18-Jan-11 23:16
Andrew Brock18-Jan-11 23:16 
GeneralRe: x86 and x64 code performance in 64 bit w7 Pin
Chesnokov Yuriy19-Jan-11 0:01
professionalChesnokov Yuriy19-Jan-11 0:01 
QuestionRe: x86 and x64 code performance in 64 bit w7 Pin
CPallini18-Jan-11 23:43
mveCPallini18-Jan-11 23:43 
AnswerRe: x86 and x64 code performance in 64 bit w7 Pin
Chesnokov Yuriy19-Jan-11 0:04
professionalChesnokov Yuriy19-Jan-11 0:04 
GeneralRe: x86 and x64 code performance in 64 bit w7 Pin
CPallini19-Jan-11 0:15
mveCPallini19-Jan-11 0:15 
Questionthe procedure entry point getsystemtimes could not be located in the dynamic link library kernel32.dll Pin
Le@rner18-Jan-11 20:45
Le@rner18-Jan-11 20:45 
AnswerRe: the procedure entry point getsystemtimes could not be located in the dynamic link library kernel32.dll Pin
Cool_Dev18-Jan-11 20:52
Cool_Dev18-Jan-11 20:52 
GeneralRe: the procedure entry point getsystemtimes could not be located in the dynamic link library kernel32.dll Pin
Le@rner18-Jan-11 20:56
Le@rner18-Jan-11 20:56 
GeneralRe: the procedure entry point getsystemtimes could not be located in the dynamic link library kernel32.dll Pin
Adam Roderick J18-Jan-11 21:02
Adam Roderick J18-Jan-11 21:02 
GeneralRe: the procedure entry point getsystemtimes could not be located in the dynamic link library kernel32.dll Pin
Cool_Dev18-Jan-11 21:13
Cool_Dev18-Jan-11 21:13 
Questionhow to add a menu in win32 dialog box? Pin
mathivanaan18-Jan-11 18:15
mathivanaan18-Jan-11 18:15 
AnswerRe: how to add a menu in win32 dialog box? Pin
tagopi18-Jan-11 18:36
tagopi18-Jan-11 18:36 
GeneralRe: how to add a menu in win32 dialog box? Pin
mathivanaan18-Jan-11 19:16
mathivanaan18-Jan-11 19:16 
AnswerRe: how to add a menu in win32 dialog box? Pin
Andrew Brock18-Jan-11 18:57
Andrew Brock18-Jan-11 18:57 
Questiondetermining exit code of a process from a dll in that process Pin
JudyL_MD18-Jan-11 15:34
JudyL_MD18-Jan-11 15:34 
AnswerRe: determining exit code of a process from a dll in that process Pin
rod naR18-Jan-11 17:01
rod naR18-Jan-11 17:01 
Questioncase sensitive sort of chars/strings...including numbers, symbols etc.. [modified] Pin
tukbriz18-Jan-11 10:04
tukbriz18-Jan-11 10:04 
AnswerRe: case sensitive sort of chars/strings...including numbers, symbols etc.. Pin
Andrew Brock18-Jan-11 19:09
Andrew Brock18-Jan-11 19:09 
GeneralRe: case sensitive sort of chars/strings...including numbers, symbols etc.. [modified] Pin
tukbriz22-Jan-11 11:37
tukbriz22-Jan-11 11:37 
AnswerRe: case sensitive sort of chars/strings...including numbers, symbols etc.. Pin
Aescleal18-Jan-11 19:57
Aescleal18-Jan-11 19:57 
Exactly how you do this depends on how often you think you're going to need to change the collation order. If it's something that doesn't change much or you haven't got that many orders you can hard code the orders in one or more functors.

If you want to parameterise the collation order even more I'd be tempted to use a map:

std::map<char, int> collation_map;


initialised with each character code and it's placing in the sort order. Then you can implement your comparison functor something like:

class collator
{
    public:
        collator( std::map<char, int> collation_map ) : collation_map_( collation_map ) {}

        bool operator()( char a, char b )
        {
            return collation_map_[ a ] < collation_map_[ b ];
        }

    private:
        std::map<char, int> collation_map_;
};


Caveats here are that this code hasn't even seen a compiler so I might have got something syntactically or semantically wrong this time of the morning. I hop the idea's sound though.
You might have some "interesting" performance issues (in terms of memory consumption) if you want to use wide characters using this method (especially on platforms with a 4 byte wide character) but it should be okay for ordinary characters.

Cheers,

Ash

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.