Re: problem with deprecated ext/hash_map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>Use <tr1/unordered_map> and std::tr1::unordered_map

Thanks
 
// Naderan *Mahmood;



----- Original Message ----
From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
To: Mahmood Naderan <nt_mahmood@xxxxxxxxx>
Cc: gcc <gcc-help@xxxxxxxxxxx>
Sent: Fri, April 1, 2011 9:27:47 PM
Subject: Re: problem with deprecated ext/hash_map

On 1 April 2011 15:53, Mahmood Naderan wrote:
> Hi,
> what happen to ext/hash_map ? What is the replacement for this header?
> I have this code: #include <ext/hash_map>
> ...
> typedef __gnu_cxx::hash_map<PhysicalMemoryAddress, InfiniteDirectoryEntry_p,
> AddrHash> inf_directory_t;
> and get this error:
> In file included from /usr/include/c++/4.4/ext/hash_map:60,
>                  from InfiniteDir.cpp:47:
> /usr/include/c++/4.4/backward/backward_warning.h:28: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.
>
> based on backward_warning.h, I used <unordered_map>. So my code changes to:
>
> #include <unordered_map>
> ...
> typedef __gnu_cxx::hash_map<PhysicalMemoryAddress, InfiniteDirectoryEntry_p,
> AddrHash> inf_directory_t;
> This time I get this error:
> In file included from /usr/include/c++/4.4/unordered_map:35,
>                  from InfiniteDirectory.cpp:47:
> /usr/include/c++/4.4/c++0x_warning.h:31:2: error: #error This file requires
> compiler and library support for the upcoming ISO C++ standard, C++0x. This
> support is currently experimental, and must be enabled with the -std=c++0x or
> -std=gnu++0x compiler options.
>
> where should I exactly use -std? In makefile?

It's a compiler option, so you would use it like any other compiler
topion.  If you invoke the compiler from a makefile, then yes, put it
in your makefile.

But you actually have several choices:

Continue to use <ext/hash_map.h> and use -Wno-deprecated to stop the warning

Use <tr1/unordered_map> and std::tr1::unordered_map

Use <unordered_map> and std::unordered_map and -std=c++0x

The second option is probably the simplest.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux