diff --git a/doc/noinit_adaptor.qbk b/doc/noinit_adaptor.qbk index f322973..24edd26 100644 --- a/doc/noinit_adaptor.qbk +++ b/doc/noinit_adaptor.qbk @@ -23,7 +23,7 @@ and whose `destroy(ptr)` invokes `value_type` destructor directly. [endsect] -[section Example] +[section Examples] The following example shows use of this allocator adaptor to achieve default initialization of elements of a trivial type, which are later assigned values. @@ -31,6 +31,7 @@ initialization of elements of a trivial type, which are later assigned values. ``` #include #include +#include int main() { @@ -39,6 +40,25 @@ int main() } ``` +The `allocate_shared_noinit` function templates are now implemented simply +using `allocate_shared` with `noinit_adaptor`. + +``` +template +enable_if_t, shared_ptr > +allocate_shared_noinit(const A& a, size_t n) +{ + return allocate_shared(boost::noinit_adapt(a), n); +} + +template +enable_if_t, shared_ptr > +allocate_shared_noinit(const A& a) +{ + return allocate_shared(boost::noinit_adapt(a)); +} +``` + [endsect] [section Reference]