patch for GCC-4.0.2
Markus Grabner <[email protected]> Tue, 30 Aug 2005 16:19:31 +0200
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Organization | Graz University of Technology |
| Message-ID | <[email protected]> |
Hi!
Compiling the examples included in mtl-2.1.2-22.tar.gz with GCC-4.0.2
produces a number of errors and warnings. The attached patch resolves these
problems.
Tested with:
*) distribution: SuSE Linux 10.0beta3
*) kernel: 2.6.13-rc6-git13-4-default
*) platform: i386 GNU/Linux
*) compiler: g++ (GCC) 4.0.2 20050818 (prerelease) (SUSE Linux)
Kind regards,
Markus
--
Markus Grabner - Computer Graphics and Vision
Graz University of Technology, Inffeldgasse 16/II, 8010 Graz, Austria
Phone: +43/316/873-5041, Fax: +43/316/873-5050
WWW: http://www.icg.tu-graz.ac.at/Members/grabner
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
mtl-2.1.2-22.patch
(text/x-diff, 5.8 KB)
diff -aur old/contrib/examples/banded_view_test.cc new/contrib/examples/banded_view_test.cc
--- old/contrib/examples/banded_view_test.cc 2005-07-05 15:11:50.000000000 +0000
+++ new/contrib/examples/banded_view_test.cc 2005-08-30 11:18:34.000000000 +0000
@@ -15,43 +15,43 @@
print_all_matrix(A);
std::cout << std::endl;
- typedef rows_type<Matrix>::type RowMatrix;
+ typedef typename rows_type<Matrix>::type RowMatrix;
std::cout << "rows banded" << std::endl;
//begin
- band_view<RowMatrix>::type B(2, 1, A);
+ typename band_view<RowMatrix>::type B(2, 1, A);
//end
print_all_banded(B, 2, 1);
print_row(B);
std::cout << std::endl;
std::cout << "columns banded" << std::endl;
- typedef columns_type<Matrix>::type ColMatrix;
- band_view<ColMatrix>::type C(2, 1, columns(A));
+ typedef typename columns_type<Matrix>::type ColMatrix;
+ typename band_view<ColMatrix>::type C(2, 1, columns(A));
print_all_banded(C, 2, 1);
print_column(C);
std::cout << std::endl;
std::cout << "rows lower triangle" << std::endl;
- triangle_view<RowMatrix, lower>::type L(A);
+ typename triangle_view<RowMatrix, lower>::type L(A);
print_all_banded(L, M-1, 0);
print_row(L);
std::cout << std::endl;
std::cout << "rows unit upper triangle" << std::endl;
- triangle_view<RowMatrix, unit_upper>::type U(A);
+ typename triangle_view<RowMatrix, unit_upper>::type U(A);
print_all_banded(U, -1, N-1);
print_row(U);
std::cout << "columns lower triangle" << std::endl;
- triangle_view<ColMatrix, lower>::type CL(columns(A));
+ typename triangle_view<ColMatrix, lower>::type CL(columns(A));
print_all_banded(CL, M-1, 0);
print_column(CL);
std::cout << std::endl;
std::cout << "columns unit upper triangle" << std::endl;
- triangle_view<ColMatrix, unit_upper>::type CU(columns(A));
+ typename triangle_view<ColMatrix, unit_upper>::type CU(columns(A));
print_all_banded(CU, -1, N-1);
print_column(CU);
//begin
diff -aur old/mtl/dimension.h new/mtl/dimension.h
--- old/mtl/dimension.h 2005-07-05 15:11:49.000000000 +0000
+++ new/mtl/dimension.h 2005-08-30 11:10:27.000000000 +0000
@@ -35,8 +35,8 @@
inline dimension(size_type m_, size_type n_) : m(m_), n(n_) { }
inline dimension& operator=(const dimension& x) {
m = x.m; n = x.n; return *this; }
- inline size_type first() const { return M ? M : m; }
- inline size_type second() const { return N ? N : n; }
+ inline size_type first() const { return M ? (size_type)M : m; }
+ inline size_type second() const { return N ? (size_type)N : n; }
inline bool is_static() const { return M != 0; }
inline transpose_type transpose() const { return transpose_type(n, m); }
/* protected: */
diff -aur old/mtl/external_vector.h new/mtl/external_vector.h
--- old/mtl/external_vector.h 2005-07-05 15:11:49.000000000 +0000
+++ new/mtl/external_vector.h 2005-08-30 11:10:27.000000000 +0000
@@ -74,7 +74,7 @@
return data_[n]; }
// Size Methods
- inline size_type size() const { return N ? N : size_; }
+ inline size_type size() const { return N ? (size_type)N : size_; }
inline void set_size(size_type n) { size_ = n; }
// Memory Access
diff -aur old/mtl/linalg_vec.h new/mtl/linalg_vec.h
--- old/mtl/linalg_vec.h 2005-07-05 15:11:49.000000000 +0000
+++ new/mtl/linalg_vec.h 2005-08-30 11:10:27.000000000 +0000
@@ -515,7 +515,7 @@
/* Size Methods */
//: The size of the vector
//!wheredef: Container
- inline size_type size() const { return N ? N : size_; }
+ inline size_type size() const { return N ? (size_type)N : size_; }
//: The number of non-zeroes in the vector
//!wheredef: Vector
diff -aur old/mtl/matrix_implementation.h new/mtl/matrix_implementation.h
--- old/mtl/matrix_implementation.h 2005-07-05 15:11:49.000000000 +0000
+++ new/mtl/matrix_implementation.h 2005-08-30 11:15:36.000000000 +0000
@@ -939,7 +939,7 @@
template<class Matrix>
inline typename rows_type<Matrix>::type
rows(const Matrix& A) {
- return rows_type<Matrix>::type(A, do_strided());
+ return typename rows_type<Matrix>::type(A, do_strided());
}
//: Access the column-wise view of the matrix
@@ -954,7 +954,7 @@
template<class Matrix>
inline typename columns_type<Matrix>::type
columns(const Matrix& A) {
- return columns_type<Matrix>::type(A, do_strided());
+ return typename columns_type<Matrix>::type(A, do_strided());
}
//: Swap the orientation of a matrix.
diff -aur old/mtl/mtl.h new/mtl/mtl.h
--- old/mtl/mtl.h 2005-07-05 15:11:49.000000000 +0000
+++ new/mtl/mtl.h 2005-08-30 11:16:24.000000000 +0000
@@ -139,7 +139,7 @@
void
scale_dim(Vector& x, const T& alpha, oned_tag)
{
- oned_scale(x, alpha, dim_n<Vector>::RET());
+ oned_scale(x, alpha, typename dim_n<Vector>::RET());
}
template <class Matrix, class T>
@@ -233,7 +233,7 @@
inline typename linalg_traits<Vector>::magnitude_type
one_norm(const Vector& x, oned_tag)
{
- return oned_one_norm(x, dim_n<Vector>::RET());
+ return oned_one_norm(x, typename dim_n<Vector>::RET());
}
@@ -285,7 +285,7 @@
inline typename linalg_traits<Vector>::magnitude_type
two_norm(const Vector& x)
{
- return oned_two_norm(x, dim_n<Vector>::RET());
+ return oned_two_norm(x, typename dim_n<Vector>::RET());
}
//: add square
@@ -2993,7 +2993,7 @@
MTL_ASSERT(x.size() <= y.size(), "mtl::ele_mult()");
MTL_ASSERT(x.size() <= z.size(), "mtl::ele_mult()");
- ele_mult(x, y, z, dim_n<VecX>::RET());
+ ele_mult(x, y, z, typename dim_n<VecX>::RET());
}
@@ -3070,7 +3070,7 @@
swap(VecX& x, VecY& y, oned_tag) MTL_THROW_ASSERTION
{
MTL_ASSERT(x.size() <= y.size(), "mtl::swap()");
- swap(x, y, dim_n<VecX>::RET());
+ swap(x, y, typename dim_n<VecX>::RET());
}
@@ -3143,7 +3143,7 @@
inline T
dot(const VecX& x, const VecY& y, T s, dense_tag, dense_tag)
{
- return dot(x, y, s, dim_n<VecX>::RET());
+ return dot(x, y, s, typename dim_n<VecX>::RET());
}
template <class InputIterator1, class InputIterator2, class T>