Introduce the hash_set and hash_map header files in Windows and Linux

Source: Internet
Author: User

Introduce the hash_set and hash_map header files in Windows and Linux

Recommended usage:Write the code before the source code:

// Just for "# include # If _ gnuc __> 2
# Include <EXT/hash_set>
# Include <EXT/hash_map>
Using namespace _ gnu_cxx;
# Else
# Include # Include Using namespace stdext;
# Endif

Other explanations and methods:

Because hash_map did not belong to the standard library before, but was introduced later.

Therefore, you need to useStlportAnd add additional library path to setting.

When GCC is used in Linux, 
One is that it is stored in the stdext namespace, so we need to use using namespace stdext to introduce the namespace and # include 
Another possibility is that it is placed under the ext directory of the standard library. In this case, you still need to use the STD namespace. In this case, your source file should be # include <EXT/hash_map>;
If you do not know which one is used, you need to check and switch to the C ++ library directory:

CD/usr/include/C ++/4 .*.*

Then run the grep command:

Grep-IR "hash_map "./

View the header file of hash_map.

After finding it, you can see the namespace in which it is included.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.