[llvm-dev] RFC: Constructing StringRefs at compile time

Malcolm Parsons via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 29 09:52:22 PST 2016


On 29 November 2016 at 17:38, Zachary Turner <zturner at google.com> wrote:
> I see, but I looked over your proposed implementation from earlier in the
> thread, and if I'm not mistaken I see this:

That's a different suggestion.

> That said, what did you think about my other proposal of the complicated UDL
> with macro?
>
> #define LIT(x) x_string_ref_literal
> constexpr StringRef Strings[] = {LIT("a"), LIT("b"), LIT("c")};

Why bother with the UDL?
#define LIT(x) StringRef((x), sizeof(x)-1)

-- 
Malcolm Parsons


More information about the llvm-dev mailing list