boostorg / boostorg/core

bit_cast/padding_cast

Open
#147 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
156
Forks
116
PR merge metrics
No merged PRs in 30d

Description

*Problem
In many cases a bit_cast is needed. However, it cannot be assumed that std::bit_cast is available. Therefore it would make sense to "rebuild" this in boost; my implementation:
[cast.hpp.txt](https://github.com/boostorg/core/files/11617919/cast.hpp.txt)

*Functionality
- if std::bit_cast or __builtin_bit_cast are available they are used -> constexpr
- otherwise reinterpret_cast is used, but with the restrictions for std::bit_cast -> not constexpr

*padding_cast
- allows resizing

thx
Gero

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.