Hello, Alle 2010/11/8 Alle Meije Wink <a.m.wink@gmail.com>
What I now have is a class bisArray: ... template<typename T> class bisArray: public bisObject { typedef boost::variant < boost::multi_array_ref<T, 1>, boost::multi_array_ref<T, 2>, boost::multi_array_ref<T, 3>, boost::multi_array_ref<T, 4>, boost::multi_array_ref<T, 5>, boost::multi_array_ref<T, 6>, boost::multi_array_ref<T, 7>, boost::multi_array_ref<T, 8>, boost::multi_array_ref<T, 9> > bisArray_t; bisArray_t _bisArray; ...
and a class bisImage, which has a bisArray as well as a pointer to the data as read from file (1-dimensional structure): ...
template<typename T>
class bisImage: public bisObject {
public:
/** Constructor using existing array data Reformats array as bisImage */ bisImage ( T* _data, size_t _dimensions, std::vector<size_t> _sizes ): data(_data), dimensions(_dimensions) {
This code (or You) comes from java or C#, doesn't it? ;-) In C++ it is supposed to be this->[...] instead of this.[...] Second thing: the member storage is initialized with the default constructor (which in this case does not exist => error ), and then assigned (below). I suggest a change to: bisImage([...]) : [...], storage( _data, _dimensions, _size ) { [...] and remove the assignment from the body of the constructor Note also: I have read in many places, that you should not use names beginning with an underscore (_), because they are reserved for compiler/library implementation. One of those places was Herb Sutter's gotw series.
this.storage=bisArray<T>( _data, _dimensions, _sizes); this.dummy = T(); }
...
When I try to initialise an image read from file using ... bisImage<unsigned char> newimage=bisImage<unsigned char> ((unsigned char *)testimage->data, ndim, dims); ...
I get, as the first of many errors, this message bisimage.hpp|33|error: no matching function for call to ‘canabis::bisArray<unsigned char>::bisArray()’|
Good lock with Your work on this! Regards, Kris