📄 vector.cc
字号:
inline Vector<P_numtype>& Vector<P_numtype>::operator/=(P_numtype x){ typedef _bz_VecExprConstant<P_numtype> T_expr; (*this) /= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator%=(P_numtype x){ typedef _bz_VecExprConstant<P_numtype> T_expr; (*this) %= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator^=(P_numtype x){ typedef _bz_VecExprConstant<P_numtype> T_expr; (*this) ^= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator&=(P_numtype x){ typedef _bz_VecExprConstant<P_numtype> T_expr; (*this) &= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator|=(P_numtype x){ typedef _bz_VecExprConstant<P_numtype> T_expr; (*this) |= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator>>=(int x){ typedef _bz_VecExprConstant<int> T_expr; (*this) >>= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator<<=(int x){ typedef _bz_VecExprConstant<P_numtype> T_expr; (*this) <<= _bz_VecExpr<T_expr>(T_expr(x)); return *this;}/***************************************************************************** * Assignment operators with vector operand */// This version is for two vectors with the same template parameter.// Does not appear to be supported by the current C++ standard; or// is it?#if 0template<typename P_numtype> template<>inline Vector<P_numtype>&Vector<P_numtype>::operator=(const Vector<P_numtype>& x){ // NEEDS_WORK: if unit strides, use memcpy or something similar. typedef VectorIterConst<P_numtype> T_expr; (*this) = _bz_VecExpr<T_expr>(T_expr(*this)); return *this;}#endif// This version is for two vectors with *different* template// parameters.template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator=(const Vector<P_numtype2>& x){ (*this) = _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator+=(const Vector<P_numtype2>& x){ (*this) += _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator-=(const Vector<P_numtype2>& x){ (*this) -= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator*=(const Vector<P_numtype2>& x){ (*this) *= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator/=(const Vector<P_numtype2>& x){ (*this) /= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator%=(const Vector<P_numtype2>& x){ (*this) %= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator^=(const Vector<P_numtype2>& x){ (*this) ^= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator&=(const Vector<P_numtype2>& x){ (*this) &= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator|=(const Vector<P_numtype2>& x){ (*this) |= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator<<=(const Vector<P_numtype2>& x){ (*this) <<= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>&Vector<P_numtype>::operator>>=(const Vector<P_numtype2>& x){ (*this) >>= _bz_VecExpr<VectorIterConst<P_numtype2> >(x.beginFast()); return *this;}/***************************************************************************** * Assignment operators with Range operand */template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator=(Range r){ (*this) = _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator+=(Range r){ (*this) += _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator-=(Range r){ (*this) -= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator*=(Range r){ (*this) *= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator/=(Range r){ (*this) /= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator%=(Range r){ (*this) %= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator^=(Range r){ (*this) ^= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator&=(Range r){ (*this) &= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator|=(Range r){ (*this) |= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator>>=(Range r){ (*this) >>= _bz_VecExpr<Range>(r); return *this;}template<typename P_numtype>inline Vector<P_numtype>& Vector<P_numtype>::operator<<=(Range r){ (*this) <<= _bz_VecExpr<Range>(r); return *this;}/***************************************************************************** * Assignment operators with VectorPick operand */template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) = _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator+=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) += _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator-=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) -= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator*=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) *= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator/=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) /= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator%=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) %= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator^=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) ^= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator&=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) &= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}template<typename P_numtype> template<typename P_numtype2>inline Vector<P_numtype>& Vector<P_numtype>::operator|=(const VectorPick<P_numtype2>& x){ typedef VectorPickIterConst<P_numtype2> T_expr; (*this) |= _bz_VecExpr<T_expr>(x.beginFast()); return *this;}/***************************************************************************** * Assignment operators with Random operand */template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator=(Random<P_distribution>& rand){ for (int i=0; i < length_; ++i) (*this)[i] = rand.random(); return *this;}#ifdef BZ_PECULIAR_RANDOM_VECTOR_ASSIGN_BUGtemplate<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator=(Random<P_distribution>& rand){ (*this) = _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator+=(Random<P_distribution>& rand){ (*this) += _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator-=(Random<P_distribution>& rand){ (*this) -= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator*=(Random<P_distribution>& rand){ (*this) *= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator/=(Random<P_distribution>& rand){ (*this) /= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator%=(Random<P_distribution>& rand){ (*this) %= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator^=(Random<P_distribution>& rand){ (*this) ^= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator&=(Random<P_distribution>& rand){ (*this) &= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}template<typename P_numtype> template<typename P_distribution>Vector<P_numtype>& Vector<P_numtype>::operator|=(Random<P_distribution>& rand){ (*this) |= _bz_VecExpr<_bz_VecExprRandom<P_distribution> > (_bz_VecExprRandom<P_distribution>(rand)); return *this;}#endif // BZ_PECULIAR_RANDOM_VECTOR_ASSIGN_BUGBZ_NAMESPACE_END#endif // BZ_VECTOR_CC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -