我想将Boost矩阵作为我的类Adsorbate
的属性。我事先知道它会是(3,2)。我想做的事:使一个类的Boost Matrix属性为
#include <boost/numeric/ublas/matrix.hpp>
using namespace boost::numeric::ublas;
class Adsorbate {
matrix<double> m(3,2);
};
,这样编译器知道属性m
的大小,因此我的课Adsorbate
。这样,我可以制作一个200个指针数组:
Adsorbate * adsorbates = (Adsorbate *) malloc(200 * sizeof(Adsorbate));
我该怎么做?