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 an older version of Boost and was released in 2018. The current version is 1.90.0.
boost::contract::is_old_value_copyable — Trait to check if an old value type can be copied or not.
// In header: <boost/contract/old.hpp> template<typename T> struct is_old_value_copyable : public boost::is_copy_constructible< T > { };
By default, this unary boolean meta-function is equivalent to boost::is_copy_constructible<T> but programmers can chose to specialize it for user-defined types (in general some kind of specialization is needed on compilers that do not support C++11, see boost::is_copy_constructible):
class u; // Some user-defined type. namespace boost { namespace contract { template<> // Specialization. struct is_old_value_copyable<u> : boost::false_type {}; } } // namespace
In summary, a given old value type T is copied only if boost::contract::is_old_value_copyable<T>::value is true. Copyable old value types are always copied using boost::contract::old_value_copy<T>. Non-copyable old value types generate a compile-time error when boost::contract::old_ptr<T> is dereferenced, but instead leave boost::contract::old_ptr_if_copyable<T> always null (without generating compile-time errors).
See Also: