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: 21.2.7 [unord.req], 21.5 [unord] Status: NAD Submitter: Matt Austern Opened: 2009-08-10 Last modified: 2016-12-23

Priority: Not Prioritized

View other active issues in [unord.req].

View all other issues in [unord.req].

View all issues with NAD status.

Discussion:

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 21.5.4 [unord.map], 21.5.5 [unord.multimap], 21.5.6 [unord.set], and 21.5.7 [unord.multiset].

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