Date: Fri, 10 Jul 2020 01:00:37 +0300
On Fri, 10 Jul 2020 at 00:51, Mandeep Sandhu
<mandeepsandhu.chd_at_[hidden]> wrote:
>
> >
> > 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)
You do not have macros after literals.
> 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, });
The literals require C++14 to work.
Perhaps you need to use an unordered_set<const char*>.
<mandeepsandhu.chd_at_[hidden]> wrote:
>
> >
> > 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)
You do not have macros after literals.
> 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, });
The literals require C++14 to work.
Perhaps you need to use an unordered_set<const char*>.
Received on 2020-07-09 17:04:03