[ox/std] Add std::string(_view) variant of MaybeView
All checks were successful
Build / build (push) Successful in 2m29s
All checks were successful
Build / build (push) Successful in 2m29s
This commit is contained in:
parent
0c0ccd1a69
commit
0f2c18d554
12
deps/ox/src/ox/std/maybeview.hpp
vendored
12
deps/ox/src/ox/std/maybeview.hpp
vendored
@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user