C++ Logo

std-discussion

Advanced search

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

From: Mandeep Sandhu <mandeepsandhu.chd_at_[hidden]>
Date: Thu, 9 Jul 2020 14:51:20 -0700
>
> I have no idea why you put those spaces there. Removing them makes the
> program compile.

I added the space after reading this:
https://gcc.gnu.org/gcc-4.7/porting_to.html (See: User-defined
literals and whitespace)

Anyway, without the space I get a different error:

$ g++ -std=c++11 -o string_udl_test string_udl_test.cc
string_udl_test.cc:7:38: error: unable to find string literal operator
‘operator""s’ with ‘const char [2]’, ‘long unsigned int’ arguments
    7 | const unordered_set<string> myset ({ "a"s, "b"s, "c"s, });
...
$ g++ --version
g++ (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-mandeep

Received on 2020-07-09 16:54:46