Tidy up some ConstRef<T> and Ref<T> constructor cases (#730)

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
mr-mocap
2023-08-19 05:10:29 -04:00
committed by GitHub
parent b3f1edc385
commit 1e6df78ec2
2 changed files with 7 additions and 6 deletions

View File

@@ -13,10 +13,11 @@ class ConstRef {
public:
ConstRef() = default;
ConstRef(const ConstRef<T>&) = default;
ConstRef(const T& t) : variant_(t) {}
ConstRef(ConstRef<T>&&) = default;
ConstRef(T t) : variant_(std::move(t)) {}
ConstRef(const T* t) : variant_(t) {}
// Make a "resetable" reference
// Make a "reseatable" reference
ConstRef<T>& operator=(const ConstRef<T>&) = default;
// Accessors:
@@ -39,11 +40,11 @@ class Ref {
public:
Ref() = default;
Ref(const Ref<T>&) = default;
Ref(const T& t) : variant_(t) {}
Ref(T&& t) : variant_(std::forward<T>(t)) {}
Ref(Ref<T>&&) = default;
Ref(T t) : variant_(std::move(t)) {}
Ref(T* t) : variant_(t) {}
// Make a "resetable" reference
// Make a "reseatable" reference.
Ref<T>& operator=(const Ref<T>&) = default;
// Accessors: