Namespaces
Variants
Views
Actions

operator==,!=,<,<=,>,>=std::valarray

From cppreference.com
< cpp‎ | numeric‎ | valarray
Revision as of 14:55, 2 November 2012 by P12bot (Talk | contribs)

 
 
 
 

Template:ddcl list begin <tr class="t-dcl ">

<td >
template< class T >

valarray<bool> operator==( const valarray<T>& lhs, const valarray<T>& rhs );
template< class T >
valarray<bool> operator!=( const valarray<T>& lhs, const valarray<T>& rhs );
template< class T >
valarray<bool> operator<( const valarray<T>& lhs, const valarray<T>& rhs );
template< class T >
valarray<bool> operator<=( const valarray<T>& lhs, const valarray<T>& rhs );
template< class T >
valarray<bool> operator>( const valarray<T>& lhs, const valarray<T>& rhs );
template< class T >

valarray<bool> operator>=( const valarray<T>& lhs, const valarray<T>& rhs );
</td>

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T >

valarray<bool> operator==( const T& lhsv, const valarray<T>& rhs );
template< class T >
valarray<bool> operator!=( const T& lhsv, const valarray<T>& rhs );
template< class T >
valarray<bool> operator<( const T& lhsv, const valarray<T>& rhs );
template< class T >
valarray<bool> operator<=( const T& lhsv, const valarray<T>& rhs );
template< class T >
valarray<bool> operator>( const T& lhsv, const valarray<T>& rhs );
template< class T >

valarray<bool> operator>=( const T& lhsv, const valarray<T>& rhs );
</td>

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T >

valarray<bool> operator==( const valarray<T>& lhs, const T& rhsv );
template< class T >
valarray<bool> operator!=( const valarray<T>& lhs, const T& rhsv );
template< class T >
valarray<bool> operator<( const valarray<T>& lhs, const T& rhsv );
template< class T >
valarray<bool> operator<=( const valarray<T>& lhs, const T& rhsv );
template< class T >
valarray<bool> operator>( const valarray<T>& lhs, const T& rhsv );
template< class T >

valarray<bool> operator>=( const valarray<T>& lhs, const T& rhsv );
</td>

<td > (3) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

Compares each value within the numeric array with another value.

1) Returns a numeric array of bool containing elements each of which is obtained by applying the indicated comparison operator to the corresponding values of lhs and rhs

The behavior is undefined if size() != v.size()

2) Returns a numeric array of bool containing elements each of which is obtained by applying the indicated comparison operator to lhsv and the corresponding value of rhs .
3) Returns a numeric array of bool containing elements each of which is obtained by applying the indicated comparison operator to the corresponding value of lhs and rhsv.

Contents

Parameters

lhs, rhs - numeric arrays to compare
lhsv, rhsv - values to compare to each element within a numeric array

Return value

A numeric array of bool containing comparison results of corresponding elements.

Exceptions

(none)

Notes

Each of the operators can only be instantiated if the following requirements are met:

  • The indicated operator can be applied to type T
  • The result value can be unambiguously converted to bool.

The function can be implemented with the return type different from std::valarray. In this case, the replacement type has the following properties:

  • All const member functions of std::valarray are provided.
  • std::valarray, std::slice_array, std::gslice_array, std::mask_array and std::indirect_array can be constructed from the replacement type.
  • All functions accepting a arguments of type const std::valarray& should also accept the replacement type.
  • All functions accepting two arguments of type const std::valarray& should accept every combination of const std::valarray& and the replacement type.
  • The return type does not add more than two levels of template nesting over the most deeply-nested argument type.