Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class old_value

boost::contract::old_value — Convert user-specified expressions to old values.

Synopsis

// In header: <boost/contract/old.hpp>


class old_value {
public:
  // construct/copy/destruct
  template<typename T> 
    old_value(T const &, 
              typename boost::enable_if< boost::contract::is_old_value_copyable< T > >::type * = 0);
  template<typename T> 
    old_value(T const &, 
              typename boost::disable_if< boost::contract::is_old_value_copyable< T > >::type * = 0);
};

Description

This class is often only implicitly used by this library and it does not explicitly appear in user code.

On older compilers that cannot correctly deduce the boost::contract::is_old_value_copyable trait, programmers can manually specialize that trait to make sure that only old value types that are copyable are actually copied.

See Also:

Old Value Requirements

old_value public construct/copy/destruct

  1. template<typename T> 
      old_value(T const & old, 
                typename boost::enable_if< boost::contract::is_old_value_copyable< T > >::type * = 0);
    Construct this object from the specified old value when the old value type is copy constructible.

    The specified old value is copied (one time only) using boost::contract::old_value_copy, in which case related old value pointer will not be null (no copy is made if postconditions and exception guarantees are not being checked, see BOOST_CONTRACT_NO_OLDS).

    Parameters:

    old

    Old value to be copied.

    Template Parameters:

    T

    Old value type.

  2. template<typename T> 
      old_value(T const & old, 
                typename boost::disable_if< boost::contract::is_old_value_copyable< T > >::type * = 0);
    Construct this object from the specified old value when the old value type is not copyable.

    The specified old value cannot be copied in this case so it is not copied and the related old value pointer will always be null (thus a call to this constructor has no effect and it will likely be optimized away by most compilers).

    Parameters:

    old

    Old value (that will not be copied in this case).

    Template Parameters:

    T

    Old value type.


PrevUpHomeNext