Boost logo

Boost :

Subject: Re: [boost] [metaparse] performance comparisons?
From: Peter Dimov (lists_at_[hidden])
Date: 2015-06-02 06:31:17

Louis Dionne wrote:
> `constexpr` char arrays and character packs are not equivalent. The
> problem is that constexpr-ness is stripped away by argument passing. For
> illustration, consider the following example:
> template <typename CompileTimeString>
> void f(CompileTimeString s) {
> static_assert(s == "abc", "");
> }
> constexpr std::string_literal<n> n4121 = "abc";
> constexpr auto n4236 = "abc"_s;
> f(n4121); // error: s is not constexpr within the body of f
> f(n4236); // ok: the value of s is contained in its type

I assume that you mean for 'f' to be constexpr?

Boost list run by bdawes at, gregod at, cpdaniel at, john at