[ox/std] Add std::string(_view) variant of MaybeView
All checks were successful
Build / build (push) Successful in 2m29s

This commit is contained in:
Gary Talent 2024-04-25 23:03:38 -05:00
parent 0c0ccd1a69
commit 0f2c18d554

View File

@ -8,7 +8,10 @@
#pragma once #pragma once
#include "typetraits.hpp" #if __has_include(<string>)
#include <string>
#include <string_view>
#endif
namespace ox { namespace ox {
@ -23,4 +26,11 @@ struct MaybeView {
template<typename T> template<typename T>
using MaybeView_t = typename MaybeView<T>::type; 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
} }