[llvm] [ADT] Add DenseSet(llvm::from_t, Range) (PR #131832)
    Kazu Hirata via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Mar 22 11:39:21 PDT 2025
    
    
  
kazutakahirata wrote:
> > Hi @kazutakahirata,
> > I thought about this over the week and I think this proposal is the most reasonable one after all. The issue with adding a range constructor is that it may lead to unintentional copies like with `DesneSet<int64_t> foo = bar();` where `bar()` returns `DenseSet<int>` or some other compatible type.
> 
> Wouldn't using an explicit ctor avoid that? That's what SmallVector does.
I may be missing a point, but do we need to worry about marking the proposed constructor?  Requiring `llvm::from_range` as the first parameter pretty much prevents accidentally invoking the proposed constructor.
https://github.com/llvm/llvm-project/pull/131832
    
    
More information about the llvm-commits
mailing list