[all-commits] [llvm/llvm-project] 5ce981: [libc++] Refactor vector move constructor with all...

Peng Liu via All-commits all-commits at lists.llvm.org
Tue Nov 26 13:00:36 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ce981e76da4094efd055ded54d1f756b1286f18
      https://github.com/llvm/llvm-project/commit/5ce981e76da4094efd055ded54d1f756b1286f18
  Author: Peng Liu <winner245 at hotmail.com>
  Date:   2024-11-26 (Tue, 26 Nov 2024)

  Changed paths:
    M libcxx/include/__vector/vector.h
    M libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp

  Log Message:
  -----------
  [libc++] Refactor vector move constructor with allocator (#116449)

This PR simplifies the implementation of std::vector's move constructor
with an alternative allocator by invoking __init_with_size() instead of
calling assign(), which ultimately calls __assign_with_size(). The
advantage of using __init_with_size() lies in its internal use of
an exception guard, which simplifies the code. Furthermore, from a
semantic standpoint, it is more intuitive for a constructor to call
an initialization function than an assignment function.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list