base.h (_Less): Use std::less.
2010-03-22 Paolo Carlini <paolo.carlini@oracle.com> * include/parallel/base.h (_Less): Use std::less. (_Plus): Likewise use std::plus. (_Multiplies): Likewise use std::multiplies. * include/parallel/numeric: Adjust. From-SVN: r157622
This commit is contained in:
parent
be36dd859d
commit
2305a1e82e
|
@ -1,3 +1,10 @@
|
||||||
|
2010-03-22 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
* include/parallel/base.h (_Less): Use std::less.
|
||||||
|
(_Plus): Likewise use std::plus.
|
||||||
|
(_Multiplies): Likewise use std::multiplies.
|
||||||
|
* include/parallel/numeric: Adjust.
|
||||||
|
|
||||||
2010-03-19 Paolo Carlini <paolo.carlini@oracle.com>
|
2010-03-19 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
* testsuite/17_intro/freestanding.cc: Avoid -Wall warnings.
|
* testsuite/17_intro/freestanding.cc: Avoid -Wall warnings.
|
||||||
|
|
|
@ -262,63 +262,40 @@ namespace __gnu_parallel
|
||||||
|
|
||||||
// Partial specialization for one type. Same as std::less.
|
// Partial specialization for one type. Same as std::less.
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct _Less<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, bool>
|
struct _Less<_Tp, _Tp>
|
||||||
{
|
: public std::less<_Tp> { };
|
||||||
bool
|
|
||||||
operator()(const _Tp& __x, const _Tp& __y) const
|
|
||||||
{ return __x < __y; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** @brief Similar to std::plus, but allows two different types. */
|
/** @brief Similar to std::plus, but allows two different types. */
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2, typename _Result
|
||||||
struct _Plus : public std::binary_function<_Tp1, _Tp2, _Tp1>
|
= __typeof__(*static_cast<_Tp1*>(NULL)
|
||||||
|
+ *static_cast<_Tp2*>(NULL))>
|
||||||
|
struct _Plus : public std::binary_function<_Tp1, _Tp2, _Result>
|
||||||
{
|
{
|
||||||
typedef __typeof__(*static_cast<_Tp1*>(NULL)
|
_Result
|
||||||
+ *static_cast<_Tp2*>(NULL)) __result;
|
|
||||||
|
|
||||||
__result
|
|
||||||
operator()(const _Tp1& __x, const _Tp2& __y) const
|
operator()(const _Tp1& __x, const _Tp2& __y) const
|
||||||
{ return __x + __y; }
|
{ return __x + __y; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Partial specialization for one type. Same as std::plus.
|
// Partial specialization for one type. Same as std::plus.
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct _Plus<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, _Tp>
|
struct _Plus<_Tp, _Tp, _Tp>
|
||||||
{
|
: public std::plus<_Tp> { };
|
||||||
typedef __typeof__(*static_cast<_Tp*>(NULL)
|
|
||||||
+ *static_cast<_Tp*>(NULL)) __result;
|
|
||||||
|
|
||||||
__result
|
|
||||||
operator()(const _Tp& __x, const _Tp& __y) const
|
|
||||||
{ return __x + __y; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** @brief Similar to std::multiplies, but allows two different types. */
|
/** @brief Similar to std::multiplies, but allows two different types. */
|
||||||
template<typename _Tp1, typename _Tp2>
|
template<typename _Tp1, typename _Tp2, typename _Result
|
||||||
struct _Multiplies : public std::binary_function<_Tp1, _Tp2, _Tp1>
|
= __typeof__(*static_cast<_Tp1*>(NULL)
|
||||||
|
* *static_cast<_Tp2*>(NULL))>
|
||||||
|
struct _Multiplies : public std::binary_function<_Tp1, _Tp2, _Result>
|
||||||
{
|
{
|
||||||
typedef __typeof__(*static_cast<_Tp1*>(NULL)
|
_Result
|
||||||
* *static_cast<_Tp2*>(NULL)) __result;
|
|
||||||
|
|
||||||
__result
|
|
||||||
operator()(const _Tp1& __x, const _Tp2& __y) const
|
operator()(const _Tp1& __x, const _Tp2& __y) const
|
||||||
{ return __x * __y; }
|
{ return __x * __y; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Partial specialization for one type. Same as std::multiplies.
|
// Partial specialization for one type. Same as std::multiplies.
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
struct _Multiplies<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, _Tp>
|
struct _Multiplies<_Tp, _Tp, _Tp>
|
||||||
{
|
: public std::multiplies<_Tp> { };
|
||||||
typedef __typeof__(*static_cast<_Tp*>(NULL)
|
|
||||||
* *static_cast<_Tp*>(NULL)) __result;
|
|
||||||
|
|
||||||
__result
|
|
||||||
operator()(const _Tp& __x, const _Tp& __y) const
|
|
||||||
{ return __x * __y; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename _Tp, typename _DifferenceTp>
|
template<typename _Tp, typename _DifferenceTp>
|
||||||
class _PseudoSequence;
|
class _PseudoSequence;
|
||||||
|
|
|
@ -281,7 +281,7 @@ namespace __parallel
|
||||||
typedef typename _TraitsType2::value_type _ValueType2;
|
typedef typename _TraitsType2::value_type _ValueType2;
|
||||||
|
|
||||||
typedef typename
|
typedef typename
|
||||||
__gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::__result
|
__gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::result_type
|
||||||
_MultipliesResultType;
|
_MultipliesResultType;
|
||||||
return inner_product(__first1, __last1, __first2, __init,
|
return inner_product(__first1, __last1, __first2, __init,
|
||||||
__gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
|
__gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
|
||||||
|
@ -301,7 +301,7 @@ namespace __parallel
|
||||||
typedef typename _TraitsType2::value_type _ValueType2;
|
typedef typename _TraitsType2::value_type _ValueType2;
|
||||||
|
|
||||||
typedef typename
|
typedef typename
|
||||||
__gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::__result
|
__gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::result_type
|
||||||
_MultipliesResultType;
|
_MultipliesResultType;
|
||||||
return inner_product(__first1, __last1, __first2, __init,
|
return inner_product(__first1, __last1, __first2, __init,
|
||||||
__gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
|
__gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
|
||||||
|
|
Loading…
Reference in New Issue