Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to calculate total line number of a text file Pin
David Crow11-Mar-09 3:17
David Crow11-Mar-09 3:17 
GeneralRe: How to calculate total line number of a text file Pin
Code-o-mat11-Mar-09 7:08
Code-o-mat11-Mar-09 7:08 
AnswerRe: How to calculate total line number of a text file Pin
Hamid_RT11-Mar-09 3:19
Hamid_RT11-Mar-09 3:19 
AnswerRe: How to calculate total line number of a text file Pin
Stuart Dootson11-Mar-09 4:12
professionalStuart Dootson11-Mar-09 4:12 
QuestionSDI-appliction Pin
susanne111-Mar-09 2:52
susanne111-Mar-09 2:52 
AnswerRe: SDI-appliction Pin
David Crow11-Mar-09 2:58
David Crow11-Mar-09 2:58 
GeneralRe: SDI-appliction Pin
susanne111-Mar-09 3:09
susanne111-Mar-09 3:09 
GeneralRe: SDI-appliction Pin
David Crow11-Mar-09 3:12
David Crow11-Mar-09 3:12 
GeneralRe: SDI-appliction Pin
susanne111-Mar-09 3:30
susanne111-Mar-09 3:30 
GeneralRe: SDI-appliction Pin
David Crow11-Mar-09 3:41
David Crow11-Mar-09 3:41 
AnswerRe: SDI-appliction Pin
SandipG 11-Mar-09 4:12
SandipG 11-Mar-09 4:12 
QuestionMy second time to design a website... Pin
JackPuppy11-Mar-09 2:15
JackPuppy11-Mar-09 2:15 
AnswerRe: My second time to design a website... Pin
Hamid_RT11-Mar-09 3:23
Hamid_RT11-Mar-09 3:23 
GeneralRe: My second time to design a website... Pin
JackPuppy11-Mar-09 3:35
JackPuppy11-Mar-09 3:35 
GeneralRe: My second time to design a website... Pin
Hamid_RT11-Mar-09 7:49
Hamid_RT11-Mar-09 7:49 
GeneralRe: My second time to design a website... Pin
JackPuppy11-Mar-09 18:13
JackPuppy11-Mar-09 18:13 
AnswerRe: My second time to design a website... Pin
Stuart Dootson11-Mar-09 3:54
professionalStuart Dootson11-Mar-09 3:54 
QuestionUnordered Map Pin
CyanCrey11-Mar-09 1:52
CyanCrey11-Mar-09 1:52 
AnswerRe: Unordered Map Pin
Stuart Dootson11-Mar-09 3:52
professionalStuart Dootson11-Mar-09 3:52 
GeneralRe: Unordered Map Pin
CyanCrey11-Mar-09 8:19
CyanCrey11-Mar-09 8:19 
GeneralRe: Unordered Map Pin
Stuart Dootson11-Mar-09 8:32
professionalStuart Dootson11-Mar-09 8:32 
It won't hash the strings - you use hash_map for that (although in my experience, std::map has better performance).

But it will compare strings properly - I guess it'll use operator<?

BTW - this code worked fine on g++ 4.0.1 (using Boost's TR1 implementation) and on VS2008 (using its own TR1):

#include <string>
#include <iostream>
#include <unordered_map>

int _tmain(int argc, _TCHAR* argv[])
{
   std::tr1::unordered_map<std::string, int> a;
   a.insert(std::make_pair("Hello", 10));
   a.insert(std::make_pair("Goodbye", 20));

   std::cout << a.count("test") << std::endl;
   std::cout << a.count("Hello") << std::endl;

   return 0;
}


This does comparisons...

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

GeneralRe: Unordered Map Pin
CyanCrey12-Mar-09 12:47
CyanCrey12-Mar-09 12:47 
QuestionSorting algorithm Pin
brucewayn11-Mar-09 1:31
brucewayn11-Mar-09 1:31 
AnswerRe: Sorting algorithm Pin
quixqx11-Mar-09 1:53
quixqx11-Mar-09 1:53 
AnswerRe: Sorting algorithm Pin
Swapnil Shah11-Mar-09 1:58
Swapnil Shah11-Mar-09 1:58 

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.