mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-25 20:27:31 +08:00
Tidy up some ConstRef<T> and Ref<T> constructor cases (#730)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
parent
b3f1edc385
commit
1e6df78ec2
@ -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:
|
||||
|
@ -849,7 +849,7 @@ class CanvasNodeBase : public Node {
|
||||
Element canvas(ConstRef<Canvas> canvas) {
|
||||
class Impl : public CanvasNodeBase {
|
||||
public:
|
||||
explicit Impl(ConstRef<Canvas> canvas) : canvas_(canvas) {
|
||||
explicit Impl(ConstRef<Canvas> canvas) : canvas_(std::move(canvas)) {
|
||||
requirement_.min_x = (canvas_->width() + 1) / 2;
|
||||
requirement_.min_y = (canvas_->height() + 3) / 4;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user