template
class StringTraits {
public:
static const CharType NULL_CHAR = \'\\0\';
static constexpr CharType* WHITESPACE_STR = \" \";
};
Here's an alternative implementation based on @zett42 's answer. Please advise me.
#include
#include
#define TOWSTRING_(x) L##x
#define TOWSTRING(x) TOWSTRING_(x)
#define MAKE_LPCTSTR(C, STR) (std::get(std::tuple(STR, TOWSTRING(STR))))
template
class StringTraits {
public:
static constexpr const CharType* WHITESPACE_STR = MAKE_LPCTSTR(CharType, "abc");
};
typedef StringTraits AStringTraits;
typedef StringTraits WStringTraits;
int main(int argc, char** argv) {
std::cout << "Narrow string literal: " << AStringTraits::WHITESPACE_STR << std::endl;
std::wcout << "Wide string literal : " << WStringTraits::WHITESPACE_STR << std::endl;
return 0;
}