I'm trying to write a small program using MTL, but I'm getting the mentioned error when I try to make a MTL Matrix a member of a class.
#include <boost/numeric/mtl/mtl.hpp>
class myClass
{
private:
mtl::dense2D<double> Ke(6,6);
};
However, there is no problem with the same statement in main():
#include <boost/numeric/mtl/mtl.hpp>
int main(int argc, char** argv)
{
mtl::dense2D<double> Ke(6,6);
return 0;
}
I'm very new to C++, and I don't think this is really related to the MTL, but that's where the error occurred for me.
You need to do that in the constructor's initialiser list.
class myClass {
mtl::dense2D<double> Ke;
public:
myClass() : Ke(mtl::dense2D<double>(6, 6)) { }
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With