Is Default Constructable really required?

John H. Hall jxyh at lanl.gov
Fri Mar 8 00:36:37 UTC 2002


Gang:
In the notes on Relations (in relations.h, copied below) it states "The 
RelationFunctor must be Default Constructable...", yet from the use of 
it, I don't see any actual requirement for this. It seems we just pass 
around const references and use the alternate required constructor 
mentioned below, along with a copy constructor. I need to set up some 
state in my RelationFunctors and I would prefer to do it during 
construction, along with providing the correct copy constructors and a 
version of this required constructor which is essentially a copy 
constructor++.

So I guess my question boils down to: "How do I set and keep state in 
RelationFunctors?" Any non-trivial use of Relations will require this.

Thanks,
John Hall


// 
----------------------------------------------------------------------------
// Relation0 is a template used to construct relations, such as boundary
// conditions, that do not depend on additional fields. The Target must 
be
// a Field. The RelationFunctor must be Default Constructable and 
Assignable.
// In addition, it must provide the constructor
//
//   template<class L>
//   RelationFunctor(const L &, const RelationFunctor &)
//
// and the member function
//
//   template<class L>
//   void operator()(const L &) const
//
// where L is a Field. The constructor should use the arguments to
// initialize itself and the function should apply the relation.
// 
----------------------------------------------------------------------------




More information about the pooma-dev mailing list