Skip to content

Instantly share code, notes, and snippets.

@Pikachuxxxx
Created November 2, 2025 06:40
Show Gist options
  • Save Pikachuxxxx/21581122df671ad8bad9348f0aceaaa4 to your computer and use it in GitHub Desktop.
Save Pikachuxxxx/21581122df671ad8bad9348f0aceaaa4 to your computer and use it in GitHub Desktop.
How Razix handles it's own std:: move
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