Created
November 2, 2025 06:40
-
-
Save Pikachuxxxx/21581122df671ad8bad9348f0aceaaa4 to your computer and use it in GitHub Desktop.
How Razix handles it's own std:: move
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace Razix { | |
| // this remote_refence is to convert a Type value from either value/ref/&& to a &&, used for custom move semantics | |
| // It removes & or && from a type so you can get the underlying base type | |
| template <typename T> struct rz_remove_reference {using type = T;}; | |
| template <typename T> struct rz_remove_reference<T&> {using type = T;}; | |
| template <typename T> struct rz_remove_reference<T&&> {using type = T;}; | |
| // custom razix move semantics, get the underlying base type and force cast to r-value ref | |
| template <typename T> | |
| constexpr typename rz_remove_reference<T>::type&& rz_move(T&& arg) noexcept | |
| { | |
| return static_cast<typename rz_remove_reference<T>::type&&>(arg); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment