4#ifndef TETL_BIT_BIT_CAST_HPP
5#define TETL_BIT_BIT_CAST_HPP
7#include <etl/_config/all.hpp>
9#include <etl/_cstddef/size_t.hpp>
10#include <etl/_strings/cstr.hpp>
11#include <etl/_type_traits/is_trivially_constructible.hpp>
12#include <etl/_type_traits/is_trivially_copyable.hpp>
18template <
typename To,
typename From>
19concept bitcastable = (
sizeof(To) ==
sizeof(From))
and is_trivially_copyable_v<From>
and is_trivially_copyable_v<To>;
37template <
typename To,
typename From>
38 requires detail::bitcastable<To, From>
39constexpr auto bit_cast(From
const& src)
noexcept -> To
41#if __has_builtin(__builtin_bit_cast) or (defined(_MSC_VER) and not defined(__clang__))
42 return __builtin_bit_cast(To, src);
45 etl::detail::memcpy<
char, etl::size_t>(&dst, &src,
sizeof(To));
constexpr auto bit_cast(From const &src) noexcept -> To
Obtain a value of type To by reinterpreting the object representation of from. Every bit in the value...
Definition bit_cast.hpp:39
Definition adjacent_find.hpp:9