Specializing the predicated methods of a function object.

Supporting Design by Contract in C++
by David Maley and Ivor Spence
Listing 4. Specializing the predicated methods of a function object.


typedef ::DBC1<Complex, Complex, double> OperatorDivide;
bool OperatorDivide::pre(const double& d) const
{
  return d!=0;
}

bool OperatorDivide::post(const Complex& returnValue, const double& d) const
{
  return d*returnValue==*_old;
}

About the Authors

David Maley is with St. Mary's University College, Belfast. He can be contacted at d.maley@stmarys-belfast.ac.uk.

Ivor Spence is with Queen's University of Belfast. He can be contacted at i.spence@qub.ac.uk.

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.