First, well done on releasing your first project. next some
constructive :p criticism:
- first you absolutely must include some more info in your header file. At the very least, you should put author, date, revision, copyright and warranty disclaimer. Theoretically I could use this code and if it didn't work, I could sue you. (it's not very likely but you should protect yourself). I'd recommend the boost licence, but there are others. to use it you just need to add
Code:
// Copyright Hussain Hani 2007.
// Distributed under the Boost Software License, Version 1.0. (See
// http://www.boost.org/LICENSE_1_0.txt)
- why is matrix restricted to floats? you could make the library a template and then users could have matrices of doubles/ints/complex numbers/whatever.
- what happens if I create a Matrix and use it without calling build? will it fail? if so, wouldn't it make more sense to require rows and columns as arguements to the constructor?
- how does print() work? the normal c++ convention would be to make an overloaded '<<' operator. that would work with printing and with files (and any other stream)
- if you're overloading the +, - and * ops it's customary to overload +=, -= and *= too. In fact you should overload those first and then op+ is simply
Code:
Matrix operator+(const Matrix& rhs)
{
Matrix result(*this);
result += rhs;
return result;
}
- const correctness - print(), getr(), getc() and about() should be const. op+, - and * should return const Matrix. this prevents accidental mistakes like (m1 * m2 = m3), which is legal but useless in your code.
That's a few points from reading the header. If you want to post the source, I'll have a look at that too. Finally, wrt to boost, they won't accept a closed source library, so you'll have to provide the source. Plus I don't think the library is up to boosts standards yet.
Sorry if that's a bit harsh. Please take the criticism in the spirit in which it's intended, which is to help you improve the library. It's a good first attempt, but it needs work.