Add StringMaker for std::(w)string_view

Fixes #1375
This commit is contained in:
melak47
2018-09-04 17:01:26 +02:00
committed by Martin Hořeňovský
parent 1eb42eed97
commit a575536abe
5 changed files with 68 additions and 13 deletions

View File

@@ -16,6 +16,10 @@
#include "catch_compiler_capabilities.h"
#include "catch_stream.h"
#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
#include <string_view>
#endif
#ifdef __OBJC__
#include "catch_objc_arc.hpp"
#endif
@@ -152,10 +156,11 @@ namespace Catch {
struct StringMaker<std::string> {
static std::string convert(const std::string& str);
};
#ifdef CATCH_CONFIG_WCHAR
#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
template<>
struct StringMaker<std::wstring> {
static std::string convert(const std::wstring& wstr);
struct StringMaker<std::string_view> {
static std::string convert(std::string_view str);
};
#endif
@@ -169,6 +174,18 @@ namespace Catch {
};
#ifdef CATCH_CONFIG_WCHAR
template<>
struct StringMaker<std::wstring> {
static std::string convert(const std::wstring& wstr);
};
# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
template<>
struct StringMaker<std::wstring_view> {
static std::string convert(std::wstring_view str);
};
# endif
template<>
struct StringMaker<wchar_t const *> {
static std::string convert(wchar_t const * str);