Skip to content

Commit

Permalink
* bits/valarray_meta.h (_Expr<>::shift, _Expr::cshift,
Browse files Browse the repository at this point in the history
	_Expr<>::apply): Implement.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35785 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
gdr committed Aug 18, 2000
1 parent a0ec9fa commit 51f950c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
5 changes: 5 additions & 0 deletions libstdc++-v3/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2000-08-18 Gabriel Dos Reis <gdr@codesourcery.com>

* bits/valarray_meta.h (_Expr<>::shift, _Expr::cshift,
_Expr<>::apply): Implement.

2000-08-18 Gabriel Dos Reis <gdr@codesourcery.com>

* bits/valarray_meta.h (_Expr<>::min, _Expr<>::max): Implement.
Expand Down
27 changes: 23 additions & 4 deletions libstdc++-v3/bits/valarray_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,9 @@ namespace std {

value_type min() const;
value_type max() const;
// _Meta<_ApplyFunctionWithValue<_Expr>, value_type>
// apply (value_type _M_func (value_type)) const;
// _Meta<_ApplyFunctionWithConstRef<_Expr>, value_type>
// apply (value_type _M_func (const value_type&)) const;

valarray<value_type> apply(value_type (*) (const value_type&)) const;
valarray<value_type> apply(value_type (*) (value_type)) const;

private:
const _Clos _M_closure;
Expand Down Expand Up @@ -718,7 +717,27 @@ namespace std {
template<class _Clos, typename _Tp>
inline size_t
_Expr<_Clos,_Tp>::size () const { return _M_closure.size (); }

template<class _Clos, typename _Tp>
inline valarray<_Tp>
_Expr<_Clos, _Tp>::shift(int __n) const
{ return valarray<_Tp>(_M_closure).shift(__n); }

template<class _Clos, typename _Tp>
inline valarray<_Tp>
_Expr<_Clos, _Tp>::cshift(int __n) const
{ return valarray<_Tp>(_M_closure).cshift(__n); }

ttemplate<class _Clos, typename _Tp>
inline valarray<_Tp>
_Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
{ return valarray<_Tp>(_M_closure).apply(__f); }

ttemplate<class _Clos, typename _Tp>
inline valarray<_Tp>
_Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
{ return valarray<_Tp>(_M_closure).apply(__f); }

// XXX: replace this with a more robust summation algorithm.
template<class _Clos, typename _Tp>
inline _Tp
Expand Down

0 comments on commit 51f950c

Please sign in to comment.