i am having problems compiling class derived from boost::multi_array. the copy constructor does not compile. as i understand, the usual copy constructor for derived class can be implemented as in line 12 in the code below. however, can't do the same for boost::multi_array at line 21. lots of compile error, i extracted a small part of it below
1 #include
2
3 // ------------------------------------------
4 template<class V> struct base {
5 base(int y) : u(y ) { }
6 base(const base<V>& b) : u(b.u) { }
7 int u;
8 };
9
10 template<class V> struct derived : public base<V> {
11 derived(int y) : base<V>(y) { }
12 derived(const derived<V>& d) : base<V>(d) { }
13 };
14 // ------------------------------------------
15 template
16 struct my_multi : public boost::multi_array {
17
18 template<class extent_type>
19 my_multi(const extent_type& e) : boost::multi_array(e) { }
20
21 my_multi(const my_multi& t) : boost::multi_array(t) { }
22 };
23 // ------------------------------------------
24 int main () {
25 derived<int> d(1.0);
26 derived<int> e(d); // ok
27
28 my_multi mm0(boost::extents[3][4]);
29 mm0[0][0] = 6; // ok
30 my_multi mm1(mm0);
31 }
--------------
extracted compile error:
bmulti.C:21: instantiated from 'my_multi::my_multi(const my_multi&) [with V = int, unsigned int D = 2u]'
bmulti.C:30: instantiated from here
/opt/local/include/boost/multi_array/collection_concept.hpp:44: error: 'struct my_multi' has no member named 'swap'
bmulti.C:21: instantiated from 'my_multi::my_multi(const my_multi&) [with V = int, unsigned int D = 2u]'
bmulti.C:30: instantiated from here
/opt/local/include/boost/multi_array/algorithm.hpp:56: error: cannot convert 'boost::detail::multi_array::const_sub_array' to 'long unsigned int' in assignment