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

Malcolm Parsons via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 29 08:31:45 PST 2016


On 29 November 2016 at 16:18, Zachary Turner <zturner at google.com> wrote:
> I don't like the llvm_strlen approach as it is incompatible with
> std::string_view which we may eventually move to.

In what way is it incompatible?

constexpr StringRef(const char* s) : Data(s), Length(llvm_strlen(s)) {}
is equivalent to
constexpr string_view(const char* s) : Data(s),
Length(std::char_traits<char>::length(s)) {}

-- 
Malcolm Parsons


More information about the llvm-dev mailing list