diff --git a/libwccl/ops/functions/conditional.h b/libwccl/ops/functions/conditional.h index 73e7d0a88bd079d4dcb369edb2a17f6608bdad98..763339c887b3f79ae5c4c1c9de1476209ed230a1 100644 --- a/libwccl/ops/functions/conditional.h +++ b/libwccl/ops/functions/conditional.h @@ -23,7 +23,7 @@ public: Conditional( const BoolFunctionPtr& cond_expr, const ArgFunctionPtr& iftrue_expr, - const ArgFunctionPtr& iffalse_expr = Default()) + const ArgFunctionPtr& iffalse_expr = detail::DefaultFunction<T>()) : cond_expr_(cond_expr), iftrue_expr_(iftrue_expr), iffalse_expr_(iffalse_expr) { BOOST_ASSERT(cond_expr_); @@ -57,11 +57,6 @@ protected: const ArgFunctionPtr iftrue_expr_; const ArgFunctionPtr iffalse_expr_; - static const ArgFunctionPtr& Default() { - static ArgFunctionPtr x(new Constant<T>(T())); - return x; - } - typedef FunctionBase::BaseRetValPtr BaseRetValPtr; /** * Evaluate the predicate. If it is true, evaluate and return value of diff --git a/libwccl/ops/functions/constant.h b/libwccl/ops/functions/constant.h index 006419f5435ee125a61781513eeed15dbf58429a..6ab839889243e5105f10edb5697075d33adb3159 100644 --- a/libwccl/ops/functions/constant.h +++ b/libwccl/ops/functions/constant.h @@ -61,6 +61,19 @@ private: const boost::shared_ptr<const T> value_; }; +namespace detail { + +/** + * Helper function creating a default Function<T> object - a Constant<T> + * that is returning default Value of given type T. + */ +template<class T> +static boost::shared_ptr<Function<T> > DefaultFunction() { + static boost::shared_ptr<Function<T> > default_fun(new Constant<T>((T()))); + return default_fun; +} + +} } /* end ns Wccl */ diff --git a/libwccl/ops/operator.h b/libwccl/ops/operator.h index 9bbb53fa94e9a97358bcaada6022101cacc16fe8..767f95815856473eb926059646f1d982202d8013 100644 --- a/libwccl/ops/operator.h +++ b/libwccl/ops/operator.h @@ -299,16 +299,6 @@ Operator<T>& Operator<T>::operator=(const Operator& other) { return *this; } -namespace detail { - -template<class T> -static boost::shared_ptr<Function<T> > DefaultFunction() { - static boost::shared_ptr<Function<T> > default_fun(new Constant<T>((T()))); - return default_fun; -} - -} - template <class T> inline Operator<T>::Operator() : FunctionalOperator((Variables())),