[llvm] r187166 - Add a bool->StringRef c'tor to StringRef.
Bill Wendling
isanbard at gmail.com
Thu Jul 25 16:06:39 PDT 2013
Author: void
Date: Thu Jul 25 18:06:39 2013
New Revision: 187166
URL: http://llvm.org/viewvc/llvm-project?rev=187166&view=rev
Log:
Add a bool->StringRef c'tor to StringRef.
Modified:
llvm/trunk/include/llvm/ADT/StringRef.h
Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=187166&r1=187165&r2=187166&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Thu Jul 25 18:06:39 2013
@@ -90,6 +90,10 @@ namespace llvm {
/*implicit*/ StringRef(const std::string &Str)
: Data(Str.data()), Length(Str.length()) {}
+ /// Construct a string ref from a boolean.
+ explicit StringRef(bool B)
+ : Data(B ? "true" : "false"), Length(::strlen(Data)) {}
+
/// @}
/// @name Iterators
/// @{
More information about the llvm-commits
mailing list