Click here to Skip to main content
15,890,690 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 19:20
Munchies_Matt14-Jul-18 19:20 
GeneralRe: Why I hate C++ Pin
Nish Nishant13-Jul-18 9:47
sitebuilderNish Nishant13-Jul-18 9:47 
GeneralRe: Why I hate C++ Pin
kalberts14-Jul-18 3:47
kalberts14-Jul-18 3:47 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 21:44
Munchies_Matt14-Jul-18 21:44 
GeneralRe: Why I hate C++ Pin
kalberts15-Jul-18 23:13
kalberts15-Jul-18 23:13 
GeneralRe: Why I hate C++ Pin
kalberts16-Jul-18 0:39
kalberts16-Jul-18 0:39 
GeneralRe: Why I hate C++ Pin
11917640 Member 14-Jul-18 21:30
11917640 Member 14-Jul-18 21:30 
GeneralRe: Why I hate C++ Pin
KBZX500016-Jul-18 2:34
KBZX500016-Jul-18 2:34 
Wait.. what?

Are you talking about std::array<t>, std::list<t> or std::map<k,v>? Don't mix their terminology, please.

I'm guessing you're dealing with a map<k,v>.
And I'm guessing the some_map[value] is initializing a KV-pair with value as key (hella confusing name, btw) and a default value (of type V).
Typically, this is done before some algorithm which relies on a particular key existing / values to be initialised to keep its complexity low.

Nothing wrong with that, except the very awful variable names.
Something like this would make more sense:

C++
std::map<keytype, valuetype=""> some_map = new std::map<keytype, valuetype="">()

// init specific keys

some_map[new KeyType("key 1")];        // adds key to some_map, in no guaranteed order, with a default ValueType

KeyType key = new KeyType("key 2");
some_map[key] = new ValueType();       // same as above, but more verbose

// do some algorithm that relies on initialized keys / values

GeneralRe: Why I hate C++ Pin
Munchies_Matt16-Jul-18 3:04
Munchies_Matt16-Jul-18 3:04 
GeneralRe: Why I hate C++ Pin
KBZX500017-Jul-18 21:32
KBZX500017-Jul-18 21:32 
GeneralRe: Why I hate C++ Pin
englebart16-Jul-18 3:40
professionalenglebart16-Jul-18 3:40 
GeneralRe: Why I hate C++ Pin
Andy Hoffmeyer16-Jul-18 3:51
Andy Hoffmeyer16-Jul-18 3:51 
GeneralRe: Why I hate C++ Pin
Munchies_Matt16-Jul-18 4:03
Munchies_Matt16-Jul-18 4:03 
GeneralRe: Why I hate C++ Pin
Steve Naidamast16-Jul-18 4:08
professionalSteve Naidamast16-Jul-18 4:08 
GeneralScrum: 1518 ? Pin
BillWoodruff13-Jul-18 2:37
professionalBillWoodruff13-Jul-18 2:37 
GeneralRe: Scrum: 1518 ? Pin
Rage13-Jul-18 3:03
professionalRage13-Jul-18 3:03 
GeneralRe: Scrum: 1518 ? Pin
MacSpudster13-Jul-18 9:23
professionalMacSpudster13-Jul-18 9:23 
GeneralRe: Scrum: 1518 ? Pin
BillWoodruff13-Jul-18 21:38
professionalBillWoodruff13-Jul-18 21:38 
GeneralWatching a horror movie... Pin
CodeWraith13-Jul-18 2:06
CodeWraith13-Jul-18 2:06 
GeneralRe: Watching a horror movie... Pin
OriginalGriff13-Jul-18 2:31
mveOriginalGriff13-Jul-18 2:31 
GeneralRe: Watching a horror movie... Pin
CodeWraith13-Jul-18 2:56
CodeWraith13-Jul-18 2:56 
GeneralRe: Watching a horror movie... Pin
OriginalGriff13-Jul-18 4:17
mveOriginalGriff13-Jul-18 4:17 
GeneralRe: Watching a horror movie... Pin
  Forogar  13-Jul-18 4:26
professional  Forogar  13-Jul-18 4:26 
QuestionProgramming Question of the Week? Pin
megaadam13-Jul-18 0:00
professionalmegaadam13-Jul-18 0:00 
AnswerRe: Programming Question of the Week? Pin
dan!sh 13-Jul-18 0:35
professional dan!sh 13-Jul-18 0:35 

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.