This is an archive of the discontinued LLVM Phabricator instance.

Add a full-featured compile-time string implementation
Needs ReviewPublic

Authored by zturner on Sep 18 2016, 4:26 PM.

Details

Reviewers
chandlerc
Summary

The original idea for this came from Scott Schurr's talk at cppcon 2015. That implementation had only 2 methods though. An operator[] and a size() method.

I wanted to see how far I could take this. I didn't think I would be able to get a pretty much completely functional compile time string class, but I did :)

I don't know if people would find this useful. The big question I have is compiler support. This works on MSVC 2015, which usually lags behind other compilers, especially when it comes to constexpr. So given that it works on VS2015, I'm inclined to believe that it works everywhere else.

In my spare time I've been working on a compile time printf implementation using variadic templates that can tokenize the format string at compile time to do argument matching, and this class is the foundation of that implementation. When it's more complete I plan to upload that as well.

In the meantime, let me know if this looks useful enough to be in LLVM.

Diff Detail

Event Timeline

zturner updated this revision to Diff 71762.Sep 18 2016, 4:26 PM
zturner retitled this revision from to Add a full-featured compile-time string implementation.
zturner updated this object.
zturner added a reviewer: chandlerc.
zturner added a subscriber: llvm-commits.

It occurred to me that a few of the names don't follow LLVM naming conventions. I'll fix that and re-upload later, so need to comment on it.