diff --git a/doc/src/refmanual/if_.rst b/doc/src/refmanual/if_.rst index 85330b8..8ce585c 100644 --- a/doc/src/refmanual/if_.rst +++ b/doc/src/refmanual/if_.rst @@ -76,6 +76,23 @@ Example BOOST_MPL_ASSERT(( is_same )); +.. parsed-literal:: + + // allocates space for an object of class T on heap or "inplace" + // depending on its size + template< typename T > struct lightweight + { + // ... + typedef typename if\_< + less_equal< sizeof\_, sizeof\_ > + , inplace_storage + , heap_storage + >::type impl_t; + + impl_t impl; + }; + + See also -------- diff --git a/doc/src/refmanual/if_c.rst b/doc/src/refmanual/if_c.rst index bdacdd9..3a0c55e 100644 --- a/doc/src/refmanual/if_c.rst +++ b/doc/src/refmanual/if_c.rst @@ -77,6 +77,23 @@ Example BOOST_MPL_ASSERT(( is_same )); +.. parsed-literal:: + + // allocates space for an object of class T on heap or "inplace" + // depending on its size + template< typename T > struct lightweight + { + // ... + typedef typename if_c< + sizeof(T) <= sizeof(T*) + , inplace_storage + , heap_storage + >::type impl_t; + + impl_t impl; + }; + + See also --------