Skip to content

insert_or_assign fails for rvalues #143

Description

@Mogball
dynamic_string key("key");

dynamic_string val1("val1");
dynamic_string val2("val2");
// ...
map.insert(key, val1); // inserts ("key", "val1")
map.insert_or_assign(key, move(val2)); // inserts ("key", "")

the value is first moved into a tuple, which is destroyed if the insertion fails,
so then the follow-up assignment assigns an empty string

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions