How to use unordered_map in android?

I try to use hash_map defined in the Android NDK, but I get a "deprecation warning":

ndk/sources/cxx-stl/gnu-libstdc++/4.6/include/ext/../backward/backward_warning.h:33:2:
error: #warning This file includes at least one deprecated or antiquated header which may 
be removed without further notice at a future date. Please use a non-deprecated interface 
with equivalent functionality instead. For a listing of replacement headers and 
interfaces, consult the file backward_warning.h. To disable this warning use -Wno-
deprecated. [-Werror=cpp]

And since "unordered_map" is present in gnu-libstd ++ / 4.6 / include /, as well as in gnu-libstd ++ / 4.6 / include / tr1 /, I believe that there is a way to use it.

The fact is, I can’t find him. Which of the following is correct (if any):

#include <tr1/unordered_map.h>

#include <unordered_map>

And then how to use it? __gnu_cxx :: unordered_map is not recognized ... and I do not know how to find this information.

+5
source share
2 answers

, ++ 11 Android-. , , , . STLPort, Boost . ++ 11 , " unordered_map" :

#include <unordered_map>
...
std::unordered_map<int, int> test;

, , ++ 11 Android .

+2

++ 11, STLPort, :

// Here we are referencing the stlport one:
#include <unordered_map>
...
std::tr1::unordered_map<int, int> test;

, STLPort unordered_map tr1, STLPort /tr1/.

+5

All Articles