Skip to content

Commit

Permalink
constexpr doesn't work here
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Apr 7, 2024
1 parent ff34c5a commit cb4e293
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions include/WeaselUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,34 +86,34 @@ inline std::string wstring_to_string(const std::wstring& wstr,

template <typename CharT>
struct EscapeChar {
static constexpr CharT escape;
static constexpr CharT linefeed;
static constexpr CharT tab;
static constexpr CharT linefeed_escape;
static constexpr CharT tab_escape;
static const CharT escape;
static const CharT linefeed;
static const CharT tab;
static const CharT linefeed_escape;
static const CharT tab_escape;
};

template <>
constexpr char EscapeChar<char>::escape = '\\';
const char EscapeChar<char>::escape = '\\';
template <>
constexpr char EscapeChar<char>::linefeed = '\n';
const char EscapeChar<char>::linefeed = '\n';
template <>
constexpr char EscapeChar<char>::tab = '\t';
const char EscapeChar<char>::tab = '\t';
template <>
constexpr char EscapeChar<char>::linefeed_escape = 'n';
const char EscapeChar<char>::linefeed_escape = 'n';
template <>
constexpr char EscapeChar<char>::tab_escape = 't';
const char EscapeChar<char>::tab_escape = 't';

template <>
constexpr char EscapeChar<wchar_t>::escape = L'\\';
const char EscapeChar<wchar_t>::escape = L'\\';
template <>
constexpr char EscapeChar<wchar_t>::linefeed = L'\n';
const char EscapeChar<wchar_t>::linefeed = L'\n';
template <>
constexpr char EscapeChar<wchar_t>::tab = L'\t';
const char EscapeChar<wchar_t>::tab = L'\t';
template <>
constexpr char EscapeChar<wchar_t>::linefeed_escape = L'n';
const char EscapeChar<wchar_t>::linefeed_escape = L'n';
template <>
constexpr char EscapeChar<wchar_t>::tab_escape = L't';
const char EscapeChar<wchar_t>::tab_escape = L't';

template <typename CharT>
inline std::basic_string<CharT> escape_string(
Expand Down

0 comments on commit cb4e293

Please sign in to comment.