diff options
| author | Jacob Palecki <[email protected]> | 2020-08-03 13:21:20 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-03 13:21:20 -0700 |
| commit | e13fe36fc04eb01bdc21cf90378d3c7c03d26a55 (patch) | |
| tree | 6b7b9b28ed970609dbeaff32352ec909dfcda98c /common/external/nillable.h | |
| parent | Add tool menu to enable\disable charts (diff) | |
| parent | Merge pull request #8 from a1xd/read (diff) | |
| download | rawaccel-e13fe36fc04eb01bdc21cf90378d3c7c03d26a55.tar.xz rawaccel-e13fe36fc04eb01bdc21cf90378d3c7c03d26a55.zip | |
Merge branch 'master' into GUI
Diffstat (limited to 'common/external/nillable.h')
| -rw-r--r-- | common/external/nillable.h | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/common/external/nillable.h b/common/external/nillable.h deleted file mode 100644 index 40cf01c..0000000 --- a/common/external/nillable.h +++ /dev/null @@ -1,30 +0,0 @@ -inline constexpr struct nil_t {} nil; - -// Requirements: T is default-constructible and trivially-destructible -template<typename T> -struct nillable { - bool has_value = false; - T value; - - nillable() = default; - - nillable(nil_t) : nillable() {} - nillable(const T& v) : has_value(true), value(v) {} - - nillable& operator=(nil_t) { - has_value = false; - return *this; - } - nillable& operator=(const T& v) { - value = v; - has_value = true; - return *this; - } - - const T* operator->() const { return &value; } - T* operator->() { return &value; } - - explicit operator bool() const { return has_value; } -}; - -template<typename T> nillable(T)->nillable<T>; |