Relations and required copy constructor

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Wed Mar 31 14:45:41 UTC 2004


Hi!

Does anyone remember why relation functors require a "copy constructor"
with the relation target as the second parameter?  I.e. why

RelationBase.h:
template<class Target, class Functor>
class RelationBase : public RelationRetargetBase<Target> {
public:


//---------------------------------------------------------------------------
  // Constructors.

  // Initialize the target and functor.

  RelationBase(const Target &t, const Functor &f)
  : RelationRetargetBase<Target>(t),
    functor_m(f, t)
    { }

here functor_m is constucted from f and t and not just f

which is called from newRelation(...) via RelationN constructor:

Relations.h:
template<class Target, class R1, class R2, class RelationFunctor>
class Relation2: public RelationBase<Target, RelationFunctor>
{
public:


//---------------------------------------------------------------------------
  // Constructors.

  Relation2(const Target &t, const R1 &r1, const R2 &r2,
    const RelationFunctor &f)
  : RelationBase<Target, RelationFunctor>(t, f), r1_m(r1), r2_m(r2)
  { }

?

I.e. what was the purpose of exposing the target to the relation functor
constructor here?

Thanks,

Richard.

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



More information about the pooma-dev mailing list