The C++ standard library headers may include each other in unspecified ways, so programmers generally shouldn\'t depend on one header including another. In a few cases, howe
This answer ignores C headers - both the and ones. Of the C++ library headers (all references are to N4659):
is guaranteed to be included by:
(§23.2.1 [utility.syn]) (§24.3.1 [string.syn]) (§26.3.2 [array.syn]) (§26.3.3 [deque.syn]) (§26.3.4 [forward_list.syn])
(§26.3.5 [list.syn]) (§26.3.6 [vector.syn]) (§26.4.2 [associative.map.syn]) (§26.4.3 [associative.set.syn]) (§26.5.2 [unord.map.syn]) (§26.5.3 [unord.set.syn]) (§26.6.2 [queue.syn]) (§26.6.3 [stack.syn]) (§28.2 [algorithms.syn]) (§29.6.2 [rand.synopsis]) (§29.7.1 [valarray.syn]) (§31.4 [re.syn]) is guaranteed to include , , , and (§30.4.1 [iostream.syn]).
is guaranteed to include (§30.5.1 [ios.syn]).
is guaranteed to include and (§23.9.1 [bitset.syn]).
The free function templates std::begin, std::end, the C++14 c-, r-, and cr- versions, and the C++17 free function templates std::size, std::empty and std::data nominally reside in , but are also available if any of the following headers is included: , , , , , , , , , , and (§27.7 [iterator.range], §27.8 [iterator.container]).
When is included, the *begin and *end functions, and the two generic std::swap overloads defined in [utility.swap] (swap(T&, T&) and swap(T (&a)[N], T (&b)[N])) are guaranteed to be available. size/empty/data, however, are not. (§24.4.1 [string.view.synop]).