Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef _GMTL_MATRIX_CONVERT_H_
00007 #define _GMTL_MATRIX_CONVERT_H_
00008
00009 #include <boost/mpl/for_each.hpp>
00010 #include <boost/mpl/range_c.hpp>
00011 #include <boost/lambda/lambda.hpp>
00012 #include <gmtl/Matrix.h>
00013
00014
00015 namespace gmtl
00016 {
00017
00036 template<typename DATA_TYPE_OUT, typename DATA_TYPE_IN, unsigned ROWS, unsigned COLS>
00037 inline gmtl::Matrix<DATA_TYPE_OUT, ROWS, COLS>
00038 convertTo(const gmtl::Matrix<DATA_TYPE_IN, ROWS, COLS>& in)
00039 {
00040 using namespace boost::lambda;
00041
00042 gmtl::Matrix<DATA_TYPE_OUT, ROWS, COLS> out;
00043
00044
00045
00046
00047 const DATA_TYPE_IN* in_data(in.mData);
00048 DATA_TYPE_OUT* out_data(out.mData);
00049
00050
00051 boost::mpl::for_each< boost::mpl::range_c<unsigned int, 0, ROWS * COLS> >(
00052 *(out_data + boost::lambda::_1) = *(in_data + boost::lambda::_1)
00053 );
00054
00055 return out;
00056 }
00057
00058 }
00059
00060
00061 #endif