To connect the map and pair you need to write

 #include <map> 

or

 #include <map> #include <utility> 

?

  • Mom uses a couple, therefore she is there. In general, you can google it easy or just try it. - AivanF.
  • @AivanF. just trying is a very bad option (although I often do this). Compilers interpret the standard very freely, and when switching to another compiler (or even with automatic updating of the current one) everything can break - Schullz
  • four
    Possible duplicate question: Dependence of header files from each other - gbg
  • @egor - do the right thing as answered in that question - if you want the most portable code - drag all the headers with you. - gbg

2 answers 2

The C ++ language standard does not regulate how the header files are related. To get the most portable program text between compilers, you need to search for a header with an explicit definition of the desired type (for example, on the site http://www.cppreference.com ) and include it.

    map is enough, there is a link to the description of the map CppReference Map , as you can see the pair already part of the map library.

    If interested, here stl_map.h implementation of stl :: map