[ox/std] Add std::string(_view) variant of MaybeView
This commit is contained in:
Vendored
+11
-1
@@ -8,7 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "typetraits.hpp"
|
||||
#if __has_include(<string>)
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -23,4 +26,11 @@ struct MaybeView {
|
||||
template<typename T>
|
||||
using MaybeView_t = typename MaybeView<T>::type;
|
||||
|
||||
#if __has_include(<string>)
|
||||
template<typename CharT, typename Traits, typename Allocator>
|
||||
struct MaybeView<std::basic_string<CharT, Traits, Allocator>> {
|
||||
using type = std::basic_string_view<CharT, Traits>;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user