Skip to content
Snippets Groups Projects
Commit 118a6f7f authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Math.h: disable scalar functions for array/class types to avoid possible...

Math.h: disable scalar functions for array/class types to avoid possible ambiguity with vector expressions
parent 6107ec75
No related branches found
No related tags found
1 merge request!49Bug fixes
......@@ -79,7 +79,7 @@ ResultType max( const T1& a, const T2& b )
* \brief This function returns absolute value of given number \e n.
*/
template< class T,
std::enable_if_t< ! std::is_unsigned<T>::value, bool > = true >
std::enable_if_t< ! std::is_unsigned<T>::value && ! std::is_class<T>::value, bool > = true >
__cuda_callable__ inline
T abs( const T& n )
{
......@@ -147,7 +147,9 @@ ResultType argAbsMax( const T1& a, const T2& b )
/**
* \brief This function returns the result of \e base to the power of \e exp.
*/
template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type >
template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type,
// enable_if is necessary to avoid ambiguity in vector expressions
std::enable_if_t< ! std::is_class<T1>::value && ! std::is_class<T2>::value, bool > = true >
__cuda_callable__ inline
ResultType pow( const T1& base, const T2& exp )
{
......@@ -458,7 +460,9 @@ void swap( Type& a, Type& b )
* It extracts the sign of the number \e a. In other words, the signum function projects
* negative numbers to value -1, positive numbers to value 1 and zero to value 0.
*/
template< class T >
template< class T,
// enable_if is necessary to avoid ambiguity in vector expressions
std::enable_if_t< ! HasSubscriptOperator<T>::value, bool > = true >
__cuda_callable__
T sign( const T& a )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment