jeudi 5 avril 2018

Defining nested class conditionally based on enclosing class template parameters

A matrix has an LU factorization only if it is square (M==N). Is there a simple way to disable class lu and method luFactorization iff M!=N below?

template<int M, int N>
class matrix {

    class lu {
        // ...
    }

    lu luFactorization() {
        // ...
    }

}

Aucun commentaire:

Enregistrer un commentaire