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

is_stateless

template <class T>
struct is_stateless : public true_type-or-false_type {};

Inherits: If T is a stateless type then inherits from true_type, otherwise from false_type.

Type T must be a complete type.

A stateless type is a type that has no storage and whose constructors and destructors are trivial. That means that is_stateless only inherits from true_type if the following expression is true:

::boost::has_trivial_constructor<T>::value
&& ::boost::has_trivial_copy<T>::value
&& ::boost::has_trivial_destructor<T>::value
&& ::boost::is_class<T>::value
&& ::boost::is_empty<T>::value

C++ Standard Reference: 3.9p10.

Header: #include <boost/type_traits/is_stateless.hpp> or #include <boost/type_traits.hpp>

Compiler Compatibility: If the compiler does not support partial-specialization of class templates, then this template can not be used with function types.

Without some (as yet unspecified) help from the compiler, is_stateless will never report that a class or struct is stateless; this is always safe, if possibly sub-optimal. Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics to ensure that this trait "just works".


PrevUpHomeNext