[ox/std] Add write(Writer_c, StringView)

This commit is contained in:
Gary Talent 2023-02-13 21:35:37 -06:00
parent b6ed919b01
commit d17f536832

View File

@ -17,6 +17,7 @@
#include "strops.hpp" #include "strops.hpp"
#include "types.hpp" #include "types.hpp"
#include "vector.hpp" #include "vector.hpp"
#include "writer.hpp"
namespace ox { namespace ox {
@ -340,6 +341,10 @@ constexpr ox::Vector<ox::StringView, smallSz> split(CRStringView str, CRStringVi
return out; return out;
} }
constexpr auto write(Writer_c auto *writer, ox::CRStringView sv) noexcept {
return writer->write(sv.data(), sv.bytes());
}
#ifdef OX_USE_STDLIB #ifdef OX_USE_STDLIB
constexpr auto toStdStringView(CRStringView sv) noexcept { constexpr auto toStdStringView(CRStringView sv) noexcept {
return std::string_view(sv.data(), sv.bytes()); return std::string_view(sv.data(), sv.bytes());