created eoOptional

This commit is contained in:
LPTK 2013-06-12 15:26:27 +02:00
commit 376a16e3e5
2 changed files with 79 additions and 34 deletions

View file

@ -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>
{