/usr/include/c++/9/ostream:692:5: error: no type named ‘type’ in ‘struct std::enable_if&>’
/usr/include/c++/9/ostream:692:5: note: template argument deduction/substitution failed:
/usr/include/c++/9/ostream: In substitution of ‘template<class _Ostream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_ostream<_Ostream>, std::__is_insertable<typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type, const _Tp&, void> >::value, typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type>::type std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_ostream<char>&; _Tp = std::basic_fstream<char>]’:
src/sparse.hpp:119:21: required from here
/usr/include/c++/9/ostream:692:5: error: no type named ‘type’ in ‘struct std::enable_if<false, std::basic_ostream<char>&>’
make: *** [Makefile:91: build/release/auglag.o] Ошибка 1
честно, вообще не понял в чём ошибка, код не мой но он 14-го года, может за это время что-то изменилось
#ifndef SPARSE_HPP
#define SPARSE_HPP
#include "util.hpp"
#include <fstream>
#include <utility>
#include <vector>
#include <ios>
inline size_t find_index (int i, const std::vector<int> &indices) {
for (size_t ii = 0; ii < indices.size(); ii++)
if (indices[ii] == i)
return ii;
return indices.size(); }
template <typename T> void insert_index (int i, int j,
std::vector<int> &indices,
std::vector<T> &entries) {
indices.insert(indices.begin() + j, i);
entries.insert(entries.begin() + j, T(0)); }
template <typename T> struct SpVec {
std::vector<int> indices;
std::vector<T> entries;
T operator[] (int i) const {
size_t j = find_index(i, indices);
if (j >= indices.size() || indices[j] != i)
return T(0);
else
return entries[j];
}
T &operator[] (int i) {// inserts entry as side-effect
size_t j = find_index(i, indices);
if (j >= indices.size() || indices[j] != i)
insert_index((int)i, (int)j, indices, entries);
return entries[j];
} };
template <typename T> std::ostream &operator<< (std::ostream &out, const SpVec<T> &v) {
out << "[";
for (int k = 0; k < v.indices.size(); k++)
out << (k==0 ? "" : ", ") << v.indices[k] << ": " << v.entries[k];
out << "]";
return out; }
template <typename T> struct SpMat {
int m, n;
std::vector< SpVec<T> > rows;
SpMat (): m(0), n(0), rows() {}
explicit SpMat (int m, int n): m(m), n(n), rows(m) {}
T operator() (int i, int j) const {
return rows[i][j];
}
T &operator() (int i, int j) {// inserts entry as side-effect
return rows[i][j];
} };
template <typename T> std::ostream &operator<< (std::ostream &out, const SpMat<T> &A) {
out << "[";
for (int i = 0; i < A.m; i++) {
const SpVec<T> &row = A.rows[i];
for (int jj = 0; jj < row.indices.size(); jj++) {
int j = row.indices[jj];
const T &aij = row.entries[jj];
out << (i==0 && jj==0 ? "" : ", ") << "(" << i << "," << j
<< "): " << aij;
}
}
out << "]";
return out; }
inline void debug_save_spmat (const SpMat<double> &A) {
static int n = 0;
std::fstream file(stringf("tmp/spmat%d", n++).c_str(), std::ios::out);
file << "SparseArray[{";
for (int i = 0; i < A.m; i++) {
const SpVec<double> &row = A.rows[i];
for (int jj = 0; jj < (int)row.indices.size(); jj++) {
int j = row.indices[jj];
const double &aij = row.entries[jj];
file << (i==0 && jj==0 ? "" : ", ") << "{" << i+1 << "," << j+1
<< "} -> " << aij;
}
}
file << "}]" << file; }
#endif
вот собственно проблемный код, есть идеи что с этим можно сделать? исходники которые собираю здесь 0.3.1 по этой инструкции