boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Class template constrained_value

boost::CV::constrained_value — A template to specify a constrained basic value type.

Synopsis

template<typename value_policies> 
class constrained_value {
public:
  // types
  typedef value_policies::value_type value_type;

  // construct/copy/destruct
  constrained_value(value_type);
  constrained_value& operator=(value_type);

  // public member functions
  operator value_type() const;

  // public static functions
  value_type max BOOST_PREVENT_MACRO_SUBSTITUTION() ;
  value_type min BOOST_PREVENT_MACRO_SUBSTITUTION() ;

  // private member functions
  void assign(value_type) ;
};

Description

This template provides a quick way to generate an integer type with a constrained range. The type provides for the ability to specify the min, max, and and error handling policy.

value policies A class that provides the range limits via the min and max functions as well as a function on_error that determines how errors are handled. A common strategy would be to assert or throw and exception. The on_error is passed both the current value and the new value that is in error.

constrained_value construct/copy/destruct

  1. constrained_value(value_type value);
  2. constrained_value& operator=(value_type v);

constrained_value public member functions

  1. operator value_type() const;

constrained_value public static functions

  1. value_type max BOOST_PREVENT_MACRO_SUBSTITUTION() ;
  2. value_type min BOOST_PREVENT_MACRO_SUBSTITUTION() ;

constrained_value private member functions

  1. void assign(value_type value) ;
Copyright © 2001-2005 CrystalClear Software, Inc

PrevUpHomeNext