created eoOptional
This commit is contained in:
parent
34cbd2ed38
commit
376a16e3e5
2 changed files with 79 additions and 34 deletions
|
|
@ -9,40 +9,6 @@
|
|||
// TODO make tests
|
||||
|
||||
|
||||
template< class T >
|
||||
class eoOptional {
|
||||
public:
|
||||
static const eoOptional<T> null; // = eoOptional<T>();
|
||||
|
||||
eoOptional (T& init)
|
||||
: _val(&init)
|
||||
{ }
|
||||
|
||||
bool hasValue() const
|
||||
{
|
||||
return _val != NULL;
|
||||
}
|
||||
|
||||
T& get () const
|
||||
{
|
||||
if (!hasValue())
|
||||
throw std::runtime_error("Cannot get a reference from a eoOptional wrapper with no value");
|
||||
return *_val;
|
||||
}
|
||||
|
||||
protected:
|
||||
eoOptional ()
|
||||
: _val(NULL)
|
||||
{ }
|
||||
|
||||
private:
|
||||
T* _val;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
const eoOptional<T> eoOptional<T>::null = eoOptional<T>();
|
||||
|
||||
|
||||
template< class EOT, class Neighbor >
|
||||
class moStdDevEstimator : public eoUF<EOT&, double>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue