How can I fix this deprecation message?

F

fuzzylollipop

here is the messages ( there are LOTS OF THEM )

winmanager.cpp(97) : warning C4996: 'std::hash_map<_Kty,_Ty>' was
declared deprecated
with
[
_Kty=HWND,
_Ty=winwrap::WindowBase *
]

winmanager.cpp(243) : warning C4996: 'std::hash_multimap<_Kty,_Ty>' was
declared deprecated
with
[
_Kty=UINT,
_Ty=boost::shared_ptr<winwrap::AbstractMessageHandler>
]

and here is the offending lines of code.

97 typedef hash_map<HWND, WindowBase*> message_map;

243 typedef hash_multimap<UINT, shared_ptr<AbstractMessageHandler> >
message_handler_list;

this is someone elses code, and I just want to clean up the compiler
warnings and do it the correct way for maintainability going forwards.
 
J

John Carson

fuzzylollipop said:
here is the messages ( there are LOTS OF THEM )

winmanager.cpp(97) : warning C4996: 'std::hash_map<_Kty,_Ty>' was
declared deprecated
with
[
_Kty=HWND,
_Ty=winwrap::WindowBase *
]

winmanager.cpp(243) : warning C4996: 'std::hash_multimap<_Kty,_Ty>'
was declared deprecated
with
[
_Kty=UINT,
_Ty=boost::shared_ptr<winwrap::AbstractMessageHandler>
]

and here is the offending lines of code.

97 typedef hash_map<HWND, WindowBase*> message_map;

243 typedef hash_multimap<UINT, shared_ptr<AbstractMessageHandler> >
message_handler_list;

this is someone elses code, and I just want to clean up the compiler
warnings and do it the correct way for maintainability going forwards.


This concerns a non-standard extension contained in the Dinkumware library
(the C++ standard does not have hash tables). The appropriate place to ask
about it is

microsoft.public.vc.language

Better yet, you can look up hash_map and hash_multimap in the documentation
of the Dinkumware library that came with your compiler. There you will find:

"In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header
files are no longer in the std namespace, but rather have been moved into
the stdext namespace. See The stdext Namespace for more information."

While these classes have been "moved", they still exist in the std namespace
for backwards compatibility reasons --- hence the warnings you are getting.
 
F

fuzzylollipop

thanks for the information, I am just getting back to C++ after a long
absence, I can't believe something as basic as hashmaps are not in the
standard!
 
J

John Carson

fuzzylollipop said:
thanks for the information, I am just getting back to C++ after a long
absence, I can't believe something as basic as hashmaps are not in the
standard!

They will almost certainly be in the next version of the standard.

Hash tables were not part of the original STL which formed the basis for the
containers in the standard library; suggestions for the inclusion of Hash
tables apparently came too late in the standardisation process to be acted
on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top