[PATCH] D125899: [ADT] Add copy constructor to IntervalMap

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 21 03:36:14 PDT 2022


dim added a comment.

In D125899#3529158 <https://reviews.llvm.org/D125899#3529158>, @dim wrote:

> 

...

> There's a subtle difference between the two std::vector constructors, mentioned at https://en.cppreference.com/w/cpp/container/vector/vector, where variant 3 is "Constructs the container with count copies of elements with value value" (so it needs a copy constructor), and variant 4 is "Constructs the container with count default-inserted instances of T. No copies are made". E.g. the latter should not require a copy constructor, but just a default constructor.

Ah, and now I see that variant 4 (the default-insert one) can't be used, because `IntervalMap` has no default constructor. It always requires an `Allocator` as parameter. As far as I can see, this is to allow allocators to be specified outside the `IntervalMap` itself, but maybe adding a default constructor, which would also use a default `Allocator`, would help instead?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125899/new/

https://reviews.llvm.org/D125899



More information about the llvm-commits mailing list