Jens Kallup
unread,Apr 10, 2012, 11:08:01 AM4/10/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hallo Gemeinde,
wo steckt hier der Fehler?
siehe Kommentare ...
Gruß
Jens
#include "boost/multi_array.hpp"
#include "boost/multi_array/base.hpp"
#include "boost/multi_array/collection_concept.hpp"
#include "boost/multi_array/copy_array.hpp"
#include "boost/multi_array/iterator.hpp"
#include "boost/multi_array/subarray.hpp"
#include "boost/multi_array/multi_array_ref.hpp"
#include "boost/multi_array/algorithm.hpp"
#include "boost/array.hpp"
#include "boost/mpl/if.hpp"
#include "boost/type_traits.hpp"
#include <stdio.h>
#include <QString>
#include <QMap>
#include <QList>
#include <iostream>
using namespace std;
class TArrayType
{
private:
int type;
typedef boost::multi_array<double, 16> array_type_double;
//array_type_double A(boost::extents[3]); // Error:
test.cc:27:32: error: 'boost::extents' is not a type
array_type_double A;
boost::array<array_type_double::index, 16> array_index;
public:
TArrayType(void) { }
TArrayType(int MemArray[16], double val)
{
type = 1;
// Error: runtime Error
boost::array<array_type_double::index, 16> array_index = { { *MemArray } };
A(array_index) = val;
}
double getDouble(void) { return A(array_index); }
};
QMap<QString, TArrayType> ArrayList;
int main(int argc, char **argv)
{
int memarr[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
ArrayList.insert("Array1",TArrayType(memarr,(double)42));
TArrayType at;
double val = ArrayList["Array1"].getDouble();
cout << val << endl;
return 0;
// This rest works fine ...
typedef boost::multi_array<double, 1> array_type;
array_type A(boost::extents[3]);
boost::array<array_type::index, 3> idx1 = { {0,0,0} };
boost::array<array_type::index, 3> idx2 = { {1,2,1} };
A(idx1) = 3.14;
A(idx2) = 42;
cout << A(idx1) << endl << A(idx2) << endl;
boost::array<array_type::index, 5> idx3 = { {1,2,1,2,0} };
A(idx3) = 1234;
cout << A(idx3) << endl;
return 0;
}