This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

1190. Setting the maximum load factor should return the previous value

Section: 26.2.7 [unord.req], 26.5 [unord] Status: NAD Submitter: Matt Austern Opened: 2009-08-10 Last modified: 2017-02-03

Priority: Not Prioritized

View other active issues in [unord.req].

View all other issues in [unord.req].

View all issues with NAD status.


The unordered associative container requirements table specifies that a.set_max_load_factor(z) has return type void. However, there is a useful piece of information to return: the previous value. Users who don't need it can always ignore it.

[ 2010 Rapperswil: ]

The benefit seems minor, while breaking with the getter/setter idiom these overloads support. Move to Tentatively NAD.

[ Moved to NAD at 2010-11 Batavia ]

Proposed resolution:

In the unordered associative container requirements table, change:

Table 87 — Unordered associative container requirements (in addition to container)
ExpressionReturn typeAssertion/note pre-/post-condition Complexity
a.max_load_factor(z) void float Pre: z shall be positive. Changes the container's maximum load load factor, using z as a hint. Returns: the previous value of a.max_load_factor(). constant

Change the return type of set_max_load_factor in the class synopses in 26.5.4 [], 26.5.5 [unord.multimap], 26.5.6 [unord.set], and 26.5.7 [unord.multiset].

If issue 1188 is also accepted, make the same changes for min_load_factor.