C++ std::set why is it associative?

c++, set, stl

Solution

23.4.6.1 Class template set overview [set.overview]

A `set` satisfies all of the requirements of [..] an associative container (23.2.4) [...]

Because it satisfies all pre-conditions of being an associative container, which are described in `23.2.4.` and aren't as simple as "maps a key to a value".

The second paragraph even highlights this (or rather, highlights that it is in fact `map` and `multimap` have additional functionality over associative containers):

23.2.4 Associative containers [associative.reqmts]

2) Each associative container is parameterized on Key and an ordering relation Compare that induces a strict weak ordering (25.4) on elements of Key. In addition, map and multimap associate an arbitrary type T with the Key. The object of type Compare is called the comparison object of a container.

The full paragraph is too large to reproduce here.

Problem

Why is `std::set` defined as an associative container? I mean `std::map` is an associative container because it maps a value to a key, but why is it a set?

Original source

Related problems