title: How to aggregate values in C++ using keys?
body: <p>In C++ how can I aggregate values for a struct based on three keys?</p>
  
  <p>In Perl I would do this using a hash of hashes (e.g. something like $hash{$key1}{$key2}{$key3}{'call_duration'} += 25);</p>
  
  <p>As I'm a complete newbie to C++ could you please suggest a suitable approach? </p>
  
  <p>I've had a look at topics on SO discussing nested hash equivalents in C++ using std::map, however it states that this is slow performance-wise and as I need to process records for a telecom operator, performance is critical.</p>
  
  <p>It's not necessary that I follow an approach that uses the template library or anything that should resemble Perl in syntax and mindset, but if you have had to do something similar, could you please share a fast and suitable way to implement it?</p>
  
  <p>I'm mostly limited to the C++ 98 standard (the technical lead has allowed the use of newer features provided that they are supported by the compiler and they are of critical benefit).</p>
  
  <p>Apologies if the description is muddled and thanks in advance!</p>
  
  <p>edit: The compiler version is GCC 4.1.2, importing tr1/functional as a library isn't frowned upon by it.</p>
  
  <p>edit: Thanks very much to everyone that joined, in particular to Bartek and Rost for putting up with my stupid questions. I decided to choose Rost's answer as it's what I was actually able to get to work! :)</p>