title: Using c++11 unordered_map types on mac os x
body: <p>I'm on MAC OS X 10.8.4 and have installed gcc by downloading XCode and the command line tools package. Here is my gcc:</p>
  
  <pre><code>Using built-in specs.
  Target: i686-apple-darwin11
  Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
  Thread model: posix
  gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
  </code></pre>
  
  <p>I'm trying to use the new unordered_map from the tr1 namespace:</p>
  
  <pre><code>using namespace std;
  #include &lt;tr1/unordered_map&gt;
  
  template&lt;class T&gt;
  class A 
  {
      tr1::unordered_map&lt;T, int&gt; * mymap;
      .....
      // key is of type T and value is of type int
      mymap-&gt;at(key) = value;
  }
  </code></pre>
  
  <p>However, the line where I'm accessing the map element using <code>at</code> is not compiling. I'm getting the following error:</p>
  
  <pre><code>error: 'class std::tr1::unordered_map&lt;int, int, std::tr1::hash&lt;int&gt;, std::equal_to&lt;int&gt;, std::allocator&lt;std::pair&lt;const int, int&gt; &gt;, false&gt;' has no member named 'at'
  </code></pre>
  
  <p>I don't quite understand this since the C++ reference does include a function called <code>at</code> to access individual elements of the map. I tried to look into the header files containing the map declaration (on my system it is at <code>/usr/include/c++/4.2.1/tr1/unordered_map</code>) and surprisingly enough, it does not contain a member named <code>at</code>.</p>
  
  <p>I understand that older compilers might not be supporting new c++11 libraries in the <code>std</code> namespace, but I've been able to use some of the other new libraries from <code>tr1</code> namespace. In fact, I can use other functions of <code>unordered_map</code> like <code>find</code>, <code>insert</code> etc. Only the member <code>at</code> is missing.</p>
  
  <p>How can I get this compiled? Should I upgrade to a newer compiler? I don't see the new compilers available for mac os x readily. Should I build it from scratch?</p>