Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Add KSTD_RCAST_FIELD_FUNCTOR & KSTD_SCAST_FIELD_FUNCTOR macros
Browse files Browse the repository at this point in the history
  • Loading branch information
KitsuneAlex committed Aug 17, 2023
1 parent 1d0ce84 commit 8b7a308
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/kstd/streams/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
return x; \
}

#define KSTD_RCAST_FIELD_FUNCTOR(n, t) \
[](auto& value) noexcept -> auto { \
return reinterpret_cast<t>(value.n); \
}

#define KSTD_SCAST_FIELD_FUNCTOR(n, t) \
[](auto& value) noexcept -> auto { \
return static_cast<t>(value.n); \
}

namespace kstd::streams {
template<typename PIPE>
struct Stream final {
Expand Down

0 comments on commit 8b7a308

Please sign in to comment.