summaryrefslogtreecommitdiff
path: root/common/external/nillable.h
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-08-01 21:08:47 -0400
committerGitHub <[email protected]>2020-08-01 21:08:47 -0400
commit1d9fb1f9007cca7ffa69b408ab7945926bbce673 (patch)
treead50871f3067dbca729e3ecfe6307fc774004b4d /common/external/nillable.h
parentMerge pull request #7 from JacobPalecki/GUI (diff)
parentmove clipp/parse logic into console project (diff)
downloadrawaccel-1d9fb1f9007cca7ffa69b408ab7945926bbce673.tar.xz
rawaccel-1d9fb1f9007cca7ffa69b408ab7945926bbce673.zip
Merge pull request #8 from a1xd/read
Read ioctl
Diffstat (limited to 'common/external/nillable.h')
-rw-r--r--common/external/nillable.h30
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>;