📄 fnoperators.h
字号:
, Minus< typename Expr<A>::result_type // Oper , int , typename Promote< typename Expr<A>::result_type , int>::promoted_t> > > operator-(const Expr<A>& a, const int& l) { typedef int arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Minus<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l))); } ///////////////////////////////////////////////////////////////////////////// // operator-(Expr) template<class A> Expr<UnaryExpr< Expr<A> // Arg1 , Negate< typename Expr<A>::result_type // Oper , typename Expr<A>::result_type> > > operator-(const Expr<A>& a) { typedef typename Expr<A>::result_type arg_t; typedef typename Expr<A>::result_type res_t; typedef typename UnaryExpr<Expr<A>, Negate<arg_t, res_t> > unaryExprT; return Expr<unaryExprT>(unaryExprT(a)); } ///////////////////////////////////////////////////////////////////////////// // operator!(Expr) template<class A> Expr<UnaryExpr< Expr<A> // Arg1 , Not< typename Expr<A>::result_type // Oper , typename Expr<A>::result_type> > > operator!(const Expr<A>& a) { typedef typename Expr<A>::result_type arg_t; typedef typename Expr<A>::result_type res_t; typedef typename UnaryExpr<Expr<A>, Not<arg_t, res_t> > unaryExprT; return Expr<unaryExprT>(unaryExprT(a)); } ///////////////////////////////////////////////////////////////////////////// // operator/(Expr, Expr) template<class A, class B> Expr<BinExpr< Expr<A> // Arg1 , Expr<B> // Arg2 , Divide< typename Expr<A>::result_type // Oper , typename Expr<B>::result_type , double> > > operator/(const Expr<A>& a, const Expr<B>& b) { typedef double res_t; typedef typename Expr<A>::result_type arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename BinExpr<Expr<A>, Expr<B>, Divide<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a,b)); }
// operator/(double, Expr)
template<class B> Expr<BinExpr< LiteralExpr<double> // Arg1 , Expr<B> // Arg2 , Divide< double // Oper , typename Expr<B>::result_type , double> > > operator/(const double& l, const Expr<B>& b) { typedef double res_t; typedef double arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename BinExpr<LiteralExpr<arg1_t>, Expr<B>, Divide<arg1_t, arg2_t, res_t> >binExprT; return Expr<binExprT>(binExprT(LiteralExpr<arg1_t>(l),b)); } // operator/(Expr, double) template<class A> Expr<BinExpr< Expr<A> // Arg1 , LiteralExpr<double> // Arg2 , Divide< typename Expr<A>::result_type // Oper , double , double> > > operator/(const Expr<A>& a, const double& l) { typedef double res_t; typedef double arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Divide<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l))); } // operator/(int, Expr) template<class B> Expr<BinExpr< LiteralExpr<int> // Arg1 , Expr<B> // Arg2 , Divide< int // Oper , typename Expr<B>::result_type , double> > > operator/(const int& l, const Expr<B>& b) { typedef double res_t; typedef int arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<LiteralExpr<arg1_t>, Expr<B>, Divide<arg1_t, arg2_t, res_t> >binExprT; return Expr<binExprT>(binExprT(LiteralExpr<arg1_t>(l),b)); } // operator/(Expr, int) template<class A> Expr<BinExpr< Expr<A> // Arg1 , LiteralExpr<int> // Arg2 , Divide< typename Expr<A>::result_type // Oper , int , double> > > operator/(const Expr<A>& a, const int& l) { typedef double res_t; typedef int arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Divide<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l))); }
/////////////////////////////////////////////////////////////////////////////
// operator*(Expr, Expr) template<class A, class B> Expr<BinExpr< Expr<A> // Arg1 , Expr<B> // Arg2 , Multiply< typename Expr<A>::result_type // Oper , typename Expr<B>::result_type , typename Promote< typename Expr<A>::result_type , typename Expr<B>::result_type>::promoted_t> > > operator*(const Expr<A>& a, const Expr<B>& b) { typedef typename Expr<A>::result_type arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<Expr<A>, Expr<B>, Multiply<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a,b)); }
// operator*(double, Expr)
template<class B> Expr<BinExpr< LiteralExpr<double> // Arg1 , Expr<B> // Arg2 , Multiply< double // Oper , typename Expr<B>::result_type , typename Promote< double , typename Expr<B>::result_type>::promoted_t> > > operator*(const double& l, const Expr<B>& b) { typedef double arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<LiteralExpr<arg1_t>, Expr<B>, Multiply<arg1_t, arg2_t, res_t> >binExprT; return Expr<binExprT>(binExprT(LiteralExpr<arg1_t>(l),b)); } // operator*(Expr, double) template<class A> Expr<BinExpr< Expr<A> // Arg1 , LiteralExpr<double> // Arg2 , Multiply< typename Expr<A>::result_type // Oper , double , typename Promote< typename Expr<A>::result_type , double>::promoted_t> > > operator*(const Expr<A>& a, const double& l) { typedef double arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Multiply<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l))); } // operator*(int, Expr) template<class B> Expr<BinExpr< LiteralExpr<int> // Arg1 , Expr<B> // Arg2 , Multiply< int // Oper , typename Expr<B>::result_type , typename Promote< int , typename Expr<B>::result_type>::promoted_t> > > operator*(const int& l, const Expr<B>& b) { typedef int arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<LiteralExpr<arg1_t>, Expr<B>, Multiply<arg1_t, arg2_t, res_t> >binExprT; return Expr<binExprT>(binExprT(LiteralExpr<arg1_t>(l),b)); } // operator*(Expr, int) template<class A> Expr<BinExpr< Expr<A> // Arg1 , LiteralExpr<int> // Arg2 , Multiply< typename Expr<A>::result_type // Oper , int , typename Promote< typename Expr<A>::result_type , int>::promoted_t> > > operator*(const Expr<A>& a, const int& l) { typedef int arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename Promote<arg1_t, arg2_t>::promoted_t res_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Multiply<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l))); }
/////////////////////////////////////////////////////////////////////////////
// power(Expr, Expr) template<class A, class B> Expr<BinExpr< Expr<A> // Arg1 , Expr<B> // Arg2 , Power< typename Expr<A>::result_type // Oper , typename Expr<B>::result_type , double> > > power(const Expr<A>& a, const Expr<B>& b) { typedef double res_t; typedef typename Expr<A>::result_type arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename BinExpr<Expr<A>, Expr<B>, Power<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a,b)); }
// power(double, Expr)
template<class B> Expr<BinExpr< LiteralExpr<double> // Arg1 , Expr<B> // Arg2 , Power< double // Oper , typename Expr<B>::result_type , double> > > power(const double& l, const Expr<B>& b) { typedef double res_t; typedef double arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename BinExpr<LiteralExpr<arg1_t>, Expr<B>, Power<arg1_t, arg2_t, res_t> >binExprT; return Expr<binExprT>(binExprT(LiteralExpr<arg1_t>(l),b)); } // power(Expr, double) template<class A> Expr<BinExpr< Expr<A> // Arg1 , LiteralExpr<double> // Arg2 , Power< typename Expr<A>::result_type // Oper , double , double> > > power(const Expr<A>& a, const double& l) { typedef double res_t; typedef double arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Power<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l))); } // power(int, Expr) template<class B> Expr<BinExpr< LiteralExpr<int> // Arg1 , Expr<B> // Arg2 , Power< int // Oper , typename Expr<B>::result_type , double> > > power(const int& l, const Expr<B>& b) { typedef double res_t; typedef int arg1_t; typedef typename Expr<B>::result_type arg2_t; typedef typename BinExpr<LiteralExpr<arg1_t>, Expr<B>, Power<arg1_t, arg2_t, res_t> >binExprT; return Expr<binExprT>(binExprT(LiteralExpr<arg1_t>(l),b)); } // power(Expr, int) template<class A> Expr<BinExpr< Expr<A> // Arg1 , LiteralExpr<int> // Arg2 , Power< typename Expr<A>::result_type // Oper , int , double> > > power(const Expr<A>& a, const int& l) { typedef double res_t; typedef int arg2_t; typedef typename Expr<A>::result_type arg1_t; typedef typename BinExpr<Expr<A>, LiteralExpr<arg2_t>, Power<arg1_t, arg2_t, res_t> > binExprT; return Expr<binExprT>(binExprT(a, LiteralExpr<arg2_t>(l)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -