const Constraint_System& T::constraints()

The polyhedra classes all provided such a method. The original reason is that it seemed the natural thing to do, since it provided the required information without requiring external storage.
The new semantic objects of the PPL cannot provide a sensible implementation of such a method, so, for consistency, they should provide the following method (BD_Shape<T> does it, Grids does not do it yet):
//! Returns a system of constraints defining \p *this. Constraint_System constraints() const;
Such a method, however, requires the creation of a temporary that the compiler normally is not able to elide. Of course, the above is valid also for generators, congruences and grid-generators. I thus propose to augment the interface of all the PPL semantic objects with methods of the form
/*! \brief Assigns to \p cs a system of constraints defining the smallest convex polyhedron that contains \p *this. */ void constraints(Constraint_System& cs)
This way, it is the caller to provide storage for the result and copies can be avoided. Comments are welcome. Ciao,
Roberto
participants (1)
-
Roberto Bagnara