Iros
Loading...
Searching...
No Matches
as_bytes.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
di/vocab/span/span_dynamic_size.h
"
4
#include "
di/vocab/span/span_fixed_size.h
"
5
6
namespace
di::vocab
{
7
namespace
detail
{
8
struct
AsBytesFunction
{
9
template
<
typename
T,
size_t
N,
size_t
S = N == dynamic_extent ? dynamic_extent : sizeof(T) * N>
10
auto
operator()
(
Span<T, N>
span)
const
->
Span<Byte const, S>
{
11
return
{
reinterpret_cast<
Byte
const*
>
(span.data()), span.size_bytes() };
12
}
13
};
14
}
15
16
constexpr
inline
auto
as_bytes
=
detail::AsBytesFunction
{};
17
}
18
19
namespace
di
{
20
using
vocab::as_bytes
;
21
}
di::vocab::Span
Definition
span_forward_declaration.h:10
di::types::Byte
std::byte Byte
Definition
byte.h:63
di::vocab::detail
Definition
erasure_cast.h:7
di::vocab
Definition
lazy.h:165
di::vocab::as_bytes
constexpr auto as_bytes
Definition
as_bytes.h:16
di
Definition
zstring_parser.h:9
span_dynamic_size.h
span_fixed_size.h
di::vocab::detail::AsBytesFunction
Definition
as_bytes.h:8
di::vocab::detail::AsBytesFunction::operator()
auto operator()(Span< T, N > span) const -> Span< Byte const, S >
Definition
as_bytes.h:10
libs
di
include
di
vocab
span
as_bytes.h
Generated by
1.13.0