[llvm-dev] StringSet copy constructor

Russell Wallace via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 31 08:52:08 PDT 2015


Ah! Fair enough. The use case isn't high frequency so I can probably just
use std::set for now.

On Mon, Aug 31, 2015 at 4:30 PM, David Blaikie <dblaikie at gmail.com> wrote:

> StringSets are just StringMaps in disguise
> StringMaps aren't copyable just because no one has had a need for that yet
> (see the comment "// FIXME: Implement copy operations if/when they're
> needed.")
>
> http://llvm.org/docs/doxygen/html/StringMap_8h_source.html
>
> If there's a need, please implement/provide a patch (along with unit tests)
>
> On Mon, Aug 31, 2015 at 8:22 AM, Russell Wallace via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> I'm trying to make a string set that has a flag to become the universal
>> set, and figured StringSet might be a good starting point
>>
>> struct Selection : StringSet<> {
>>   bool all;
>>
>>   Selection(const Selection &selection)
>>       : StringSet<>(selection), all(selection.all) {}
>>
>>   Selection(bool all) : all(all) {}
>>
>>   size_t count(const string &s) const {
>>     if (all)
>>       return true;
>>     return StringSet<>::count(s);
>>   }
>> };
>>
>> But I get an error when trying to compile
>>
>> error C2280: 'llvm::StringSet<llvm::MallocAllocator>::StringSet(const
>> llvm::StringSet<llvm::MallocAllocator> &)': attempting to reference a
>> deleted function
>> \llvm\include\llvm/ADT/StringSet.h(31): note: compiler has generated
>> 'llvm::StringSet<llvm::MallocAllocator>::StringSet' here
>>
>> The indicated line is on my constructor declaration - is this not the
>> right way to copy a StringSet?
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150831/59fa498e/attachment.html>


More information about the llvm-dev mailing list