C++ Logo

std-discussion

Advanced search

Re: extremely long compile time with large number of string literals

From: Artur Czajkowski <atch.cpp_at_[hidden]>
Date: Fri, 10 Jul 2020 08:25:46 +0200
@Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
I'm not talking about putting limits on compilation time. I'm talking about
introducing constraints in a form of Big O notation with regards to time
complexity that needs to be met by compiler implementer in order to conform
to the standard.


On Thu, Jul 9, 2020 at 11:34 PM Mandeep Sandhu via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> >
> > Overload resolution. Try passing suffixed-string literals,
> >
> > const std::unordered_set<std::string> my_set ({"item1"s, "item2"s,
> ....});
>
> I tried creating UDL strings like you suggested (but with a space
> between the literal & s), but it doesn't compile for me.
>
> A simple program like:
> ...
> const unordered_set<string> myset ({ "a" s, "b" s, "c" s, });
> int main()
> {
> cout << "size of myset = " << myset.size() << endl;
> }
>
> Doesn't compile, I get the error:
> ...
> error: expected ā€˜}ā€™ before ā€˜sā€™
> 7 | const unordered_set<string> myset ({ "a" s, "b" s, "c" s, });
>
> Maybe I'm doing it wrong (I haven't used UDLs before).
>
> Thanks.
> -mandeep
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>


-- 
Best regards
*Artur Czajkowski*
https://marketplace.visualstudio.com/items?itemName=GitAtomic.GitAtomic

Received on 2020-07-10 01:29:15