Демонстрирует простой алгоритм, который использует<__has_trivial_destruct>для определения необходимости вызова деструкторов (см.trivial_destructor_example.cpp).:
//// algorithm destroy_array:// The reverse of std::unitialized_copy, takes a block of// initialized memory and calls destructors on all objects therein.//namespacedetail{template<classT>voiddo_destroy_array(T*first,T*last,constboost::false_type&){while(first!=last){first->~T();++first;}}template<classT>inlinevoiddo_destroy_array(T*first,T*last,constboost::true_type&){}}// namespace detailtemplate<classT>inlinevoiddestroy_array(T*p1,T*p2){detail::do_destroy_array(p1,p2,::boost::has_trivial_destructor<T>());}
Статья An Example that Omits Destructor Calls For Types with Trivial Destructors раздела Chapter 1. Boost.TypeTraits Examples может быть полезна для разработчиков на c++ и boost.