mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-16 16:08:08 +08:00
Remove input.hpp
This commit is contained in:

committed by
Arthur Sonzogni

parent
7ee6edfd1f
commit
26db8228f9
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ftxui {
|
||||
|
||||
/// @brief An adapter. Own or reference a constant object.
|
||||
/// @brief An adapter. Own or reference an immutable object.
|
||||
template <typename T>
|
||||
class ConstRef {
|
||||
public:
|
||||
@@ -14,6 +14,7 @@ class ConstRef {
|
||||
ConstRef(T t) : owned_(t) {}
|
||||
ConstRef(const T* t) : address_(t) {}
|
||||
const T& operator*() { return address_ ? *address_ : owned_; }
|
||||
const T& operator()() { return address_ ? *address_ : owned_; }
|
||||
const T* operator->() { return address_ ? address_ : &owned_; }
|
||||
|
||||
private:
|
||||
@@ -21,6 +22,22 @@ class ConstRef {
|
||||
const T* address_ = nullptr;
|
||||
};
|
||||
|
||||
/// @brief An adapter. Own or reference an mutable object.
|
||||
template <typename T>
|
||||
class Ref{
|
||||
public:
|
||||
Ref() {}
|
||||
Ref(T t) : owned_(t) {}
|
||||
Ref(T* t) : address_(t) {}
|
||||
T& operator*() { return address_ ? *address_ : owned_; }
|
||||
T& operator()() { return address_ ? *address_ : owned_; }
|
||||
T* operator->() { return address_ ? address_ : &owned_; }
|
||||
|
||||
private:
|
||||
T owned_;
|
||||
T* address_ = nullptr;
|
||||
};
|
||||
|
||||
/// @brief An adapter. Own or reference a constant string. For convenience, this
|
||||
/// class convert multiple mutable string toward a shared representation.
|
||||
class StringRef {
|
||||
|
Reference in New Issue
Block a user