2022-03-11 21:29:59 +00:00
|
|
|
#pragma once
|
|
|
|
#include <assimp/ai_assert.h>
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct Maybe {
|
|
|
|
private:
|
|
|
|
T _val;
|
|
|
|
bool _valid;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Maybe() :
|
|
|
|
_valid(false) {}
|
|
|
|
|
|
|
|
explicit Maybe(const T &val) :
|
2022-03-12 07:15:11 +00:00
|
|
|
_val(val), _valid(true) {
|
2022-03-11 21:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
operator bool() const {
|
|
|
|
return _valid;
|
|
|
|
}
|
|
|
|
|
|
|
|
const T &Get() const {
|
|
|
|
ai_assert(_valid);
|
|
|
|
return _val;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Maybe &operator&() = delete;
|
|
|
|
};
|