MeshLib C++ Docs
Loading...
Searching...
No Matches
MRBitCast.h
Go to the documentation of this file.
1#pragma once
2
3#include <version>
4
5#if __cpp_lib_bit_cast >= 201806L
6#include <bit>
7#endif
8
9namespace MR
10{
13
14
16template <typename To, typename From>
17[[nodiscard]] constexpr To bit_cast( const From& from ) noexcept
18{
19#if __cpp_lib_bit_cast >= 201806L
20 return std::bit_cast<To>( from );
21#else
22 return __builtin_bit_cast( To, from );
23#endif
24}
25
26}
constexpr To bit_cast(const From &from) noexcept
std::bit_cast wrapper with the compiler's intrinsic fallback
Definition MRBitCast.h:17
only for bindings generation
Definition MRCameraOrientationPlugin.h:8