Skip to content

Commit

Permalink
Merge pull request #264 from JM1/master
Browse files Browse the repository at this point in the history
Fix ambiguous template special. errors with GCC 7+
  • Loading branch information
poulson authored Aug 13, 2018
2 parents ed91bc4 + f3ede00 commit a666cf4
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 141 deletions.
10 changes: 5 additions & 5 deletions include/El/blas_like/level1/decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void Contract( const BlockMatrix<T>& A, BlockMatrix<T>& B );
template<typename T>
void Copy( const Matrix<T>& A, Matrix<T>& B );
template<typename S,typename T,
typename=EnableIf<CanCast<S,T>>>
typename=EnableIf<And< CanCast<S,T>, Not<IsSame<S,T>> >>>
void Copy( const Matrix<S>& A, Matrix<T>& B );

template<typename S,typename T,
Expand All @@ -501,7 +501,7 @@ void Copy( const BlockMatrix<S>& A, BlockMatrix<T>& B );
template<typename T>
void Copy( const AbstractDistMatrix<T>& A, AbstractDistMatrix<T>& B );
template<typename S,typename T,
typename=EnableIf<CanCast<S,T>>>
typename=EnableIf<And< CanCast<S,T>, Not<IsSame<S,T>> >>>
void Copy( const AbstractDistMatrix<S>& A, AbstractDistMatrix<T>& B );

template<typename T>
Expand Down Expand Up @@ -532,7 +532,7 @@ template<typename T>
void Copy( const SparseMatrix<T>& A, SparseMatrix<T>& B );

template<typename S,typename T,
typename=EnableIf<CanCast<S,T>>>
typename=EnableIf<And< CanCast<S,T>, Not<IsSame<S,T>> >> >
void Copy( const SparseMatrix<S>& A, SparseMatrix<T>& B );

template<typename S,typename T,
Expand All @@ -543,7 +543,7 @@ template<typename T>
void Copy( const DistSparseMatrix<T>& A, DistSparseMatrix<T>& B );

template<typename S,typename T,
typename=EnableIf<CanCast<S,T>>>
typename=EnableIf<And<CanCast<S,T>,Not<IsSame<S,T>>>>>
void Copy( const DistSparseMatrix<S>& A, DistSparseMatrix<T>& B );

template<typename S,typename T,
Expand All @@ -559,7 +559,7 @@ template<typename T>
void Copy( const DistMultiVec<T>& A, DistMultiVec<T>& B );

template<typename S,typename T,
typename=EnableIf<CanCast<S,T>>>
typename=EnableIf< And< CanCast<S,T>, Not<IsSame<S,T>> > >>
void Copy( const DistMultiVec<S>& A, DistMultiVec<T>& B );

template<typename T>
Expand Down
10 changes: 10 additions & 0 deletions include/El/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ enum FortranLogicalEnum
template<typename S,typename T>
using IsSame = std::is_same<S,T>;

template<typename S, typename T>
struct And {
static constexpr bool value = S::value && T::value;
};

template<typename T>
struct Not {
static constexpr bool value = !T::value;
};

template<typename Condition,class T=void>
using EnableIf = typename std::enable_if<Condition::value,T>::type;
template<typename Condition,class T=void>
Expand Down
Loading

0 comments on commit a666cf4

Please sign in to comment.