style: adjust clang-format rules (#2186)

Co-authored-by: Vithorio Polten <reach@vithor.io>
This commit is contained in:
ReenigneArcher
2025-01-19 22:34:47 -05:00
committed by GitHub
parent f57aee9025
commit c2420427b1
158 changed files with 8754 additions and 9994 deletions

View File

@@ -4,6 +4,7 @@
*/
#pragma once
// standard includes
#include <utility>
/**
@@ -14,7 +15,7 @@ namespace move_by_copy_util {
* When a copy is made, it moves the object
* This allows you to move an object when a move can't be done.
*/
template <class T>
template<class T>
class MoveByCopy {
public:
typedef T move_type;
@@ -24,7 +25,8 @@ namespace move_by_copy_util {
public:
explicit MoveByCopy(move_type &&to_move):
_to_move(std::move(to_move)) {}
_to_move(std::move(to_move)) {
}
MoveByCopy(MoveByCopy &&other) = default;
@@ -32,11 +34,9 @@ namespace move_by_copy_util {
*this = other;
}
MoveByCopy &
operator=(MoveByCopy &&other) = default;
MoveByCopy &operator=(MoveByCopy &&other) = default;
MoveByCopy &
operator=(const MoveByCopy &other) {
MoveByCopy &operator=(const MoveByCopy &other) {
this->_to_move = std::move(const_cast<MoveByCopy &>(other)._to_move);
return *this;
@@ -47,16 +47,14 @@ namespace move_by_copy_util {
}
};
template <class T>
MoveByCopy<T>
cmove(T &movable) {
template<class T>
MoveByCopy<T> cmove(T &movable) {
return MoveByCopy<T>(std::move(movable));
}
// Do NOT use this unless you are absolutely certain the object to be moved is no longer used by the caller
template <class T>
MoveByCopy<T>
const_cmove(const T &movable) {
template<class T>
MoveByCopy<T> const_cmove(const T &movable) {
return MoveByCopy<T>(std::move(const_cast<T &>(movable)));
}
} // namespace move_by_copy_util