Click here to Skip to main content
15,901,122 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionmapping pthread id to custom id Pin
meerokh13-Jul-18 5:51
meerokh13-Jul-18 5:51 
GeneralRe: mapping pthread id to custom id Pin
Richard MacCutchan13-Jul-18 20:48
mveRichard MacCutchan13-Jul-18 20:48 
GeneralRe: mapping pthread id to custom id Pin
meerokh14-Jul-18 0:24
meerokh14-Jul-18 0:24 
GeneralRe: mapping pthread id to custom id Pin
Richard MacCutchan14-Jul-18 3:36
mveRichard MacCutchan14-Jul-18 3:36 
QuestionHow to disable a HTML Input in c# Pin
Member 1219465611-Jul-18 15:50
Member 1219465611-Jul-18 15:50 
AnswerRe: How to disable a HTML Input in c# Pin
Bryian Tan11-Jul-18 17:30
professionalBryian Tan11-Jul-18 17:30 
Questionc++ - std :: map - Is my idea too dirty? Pin
User 1106097911-Jul-18 8:40
User 1106097911-Jul-18 8:40 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
harold aptroot11-Jul-18 9:48
harold aptroot11-Jul-18 9:48 
PraiseRe: c++ - std :: map - Is my idea too dirty? Pin
User 1106097911-Jul-18 9:54
User 1106097911-Jul-18 9:54 
AnswerRe: c++ - std :: map - Is my idea too dirty? Pin
Richard MacCutchan11-Jul-18 19:44
mveRichard MacCutchan11-Jul-18 19:44 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
harold aptroot12-Jul-18 12:34
harold aptroot12-Jul-18 12:34 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
Richard MacCutchan12-Jul-18 19:42
mveRichard MacCutchan12-Jul-18 19:42 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
harold aptroot12-Jul-18 20:19
harold aptroot12-Jul-18 20:19 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
Richard MacCutchan12-Jul-18 20:41
mveRichard MacCutchan12-Jul-18 20:41 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
User 1106097913-Jul-18 7:44
User 1106097913-Jul-18 7:44 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
Richard MacCutchan13-Jul-18 19:13
mveRichard MacCutchan13-Jul-18 19:13 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
Richard MacCutchan14-Jul-18 4:10
mveRichard MacCutchan14-Jul-18 4:10 
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
User 1106097914-Jul-18 5:19
User 1106097914-Jul-18 5:19 
AnswerRe: c++ - std :: map - Is my idea too dirty? Pin
CPallini11-Jul-18 21:22
mveCPallini11-Jul-18 21:22 
AnswerRe: c++ - std :: map - Is my idea too dirty? Pin
Jochen Arndt12-Jul-18 23:13
professionalJochen Arndt12-Jul-18 23:13 
I'm a bit late to the party.

The key point of a map is that no two elements in a map container can have equivalent keys. If the number of significant digits entered is less than the precision of double values, this will not happen (besides entering the same value again which applies to ints as well).

But you might get problems when trying to access elements by key when the argument is from other sources (affected by rounding).

That would be my bad feeling:
While there is no problem with the map itself, key based operations ([]operator, erase, swap, find) might behave not as expected (no match). Even when not using such operations now but only iterator based ones, they may be used later when updating the code. So you should at least place a comment about this.

Another option is creating your own std::map based class that disables the affected operations or replaces them with a version that treats close numbers as identical (defining an epsilon).
GeneralRe: c++ - std :: map - Is my idea too dirty? Pin
User 1106097913-Jul-18 6:54
User 1106097913-Jul-18 6:54 
AnswerRe: c++ - std :: map - Is my idea too dirty? Pin
Randor 23-Jul-18 12:20
professional Randor 23-Jul-18 12:20 
PraiseRe: c++ - std :: map - Is my idea too dirty? Pin
User 1106097923-Jul-18 20:48
User 1106097923-Jul-18 20:48 
Questionneed COM/DCOM basics Pin
Sakthiu11-Jul-18 3:35
Sakthiu11-Jul-18 3:35 
AnswerRe: need COM/DCOM basics Pin
jeron111-Jul-18 4:07
jeron111-Jul-18 4:07 

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.