Functors and Array ctors

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Thu Jul 4 12:39:00 UTC 2002


Hi!

In resurrecting RectilinearMesh, I came across the problem of creating
a Functor for IndexFunction engine containing an Array<> member. This
lead to lots of problems with appearantly incorrectly(?) autogenerated
copy constructors and assignment operators for this functor. Those seem
at some point always to invoke a Array.assign() operation which does
assert for uninitialized Arrays.

I worked around this by defining constructor, assignment and copy
constructors that do essentially

  whichever(const Array&a)
  {
    array_m.engine() = Engine<1, T, Brick>(a.engine());
    array_m = a;
  }

I.e. manually re-set the engines before assignment.

Is there a better way to achieve this? How would one handle Functors with
Array members? Is Array flawed in not allowing it to be compile-generated
copy-constructable?

Any hints/help appreciated, Richard.

--
Richard Guenther <richard.guenther at uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/




More information about the pooma-dev mailing list