diff --git a/src/binary.cpp b/src/binary.cpp index a3ea0b2cc..6c7e687d7 100644 --- a/src/binary.cpp +++ b/src/binary.cpp @@ -3,7 +3,7 @@ #include namespace YAML { -static const char encoding[] = +static constexpr char encoding[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; std::string EncodeBase64(const unsigned char *data, std::size_t size) { @@ -44,7 +44,7 @@ std::string EncodeBase64(const unsigned char *data, std::size_t size) { return ret; } -static const unsigned char decoding[] = { +static constexpr unsigned char decoding[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, diff --git a/src/convert.cpp b/src/convert.cpp index 9658b3603..95785dc41 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -45,8 +45,8 @@ bool convert::decode(const Node& node, bool& rhs) { // we can't use iostream bool extraction operators as they don't // recognize all possible values in the table below (taken from // http://yaml.org/type/bool.html) - static const struct { - std::string truename, falsename; + static constexpr struct { + const char *truename, *falsename; } names[] = { {"y", "n"}, {"yes", "no"}, diff --git a/src/emitterutils.cpp b/src/emitterutils.cpp index 74e58abdd..29fcb93f6 100644 --- a/src/emitterutils.cpp +++ b/src/emitterutils.cpp @@ -229,7 +229,7 @@ std::pair EncodeUTF16SurrogatePair(int codePoint) { } void WriteDoubleQuoteEscapeSequence(ostream_wrapper& out, int codePoint, StringEscaping::value stringEscapingStyle) { - static const char hexDigits[] = "0123456789abcdef"; + static constexpr char hexDigits[] = "0123456789abcdef"; out << "\\"; int digits = 8;