Opened 7 years ago

Closed 6 years ago

#11296 closed Feature Requests (wontfix)

Function to update key

Reported by: Olaf van der Spek <olafvdspek@…> Owned by: Daniel James
Milestone: To Be Determined Component: unordered
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

Sometimes the key of a node has to be updated. Could you add a function for this?

void update_key(iterator, key_type);

It allows an alloc / dealloc pair to be avoided and it allows for simpler (client) code.

Change History (1)

comment:1 by Daniel James, 6 years ago

Resolution: wontfix
Status: newclosed

The C++17 way to do this is to extract the node, change the key, and insert it. I'll be implementing that in a future version. Something like:

auto n = x.extract(it);
n.key() = 100;
x.insert(n);
Note: See TracTickets for help on using tickets.