00001 #ifndef STATIC_CONTAINER_CONTAINER_DESTRUCT_H
00002
00003 #define STATIC_CONTAINER_CONTAINER_DESTRUCT_H
00004
00005 #include <boost/type_traits/is_pod.hpp>
00006 #include <boost/mpl/if.hpp>
00007
00008 namespace static_container {
00009 namespace detail {
00010 template < typename T >
00011 struct destructor_caller {
00012 static void call( T& t ) {
00013 t.~T();
00014 }
00015 };
00016
00017 template < typename T >
00018 struct through {
00019 static void call( T& t ) {}
00020 };
00021 }
00022
00024 template < typename T >
00025 void destruct( T& t ) {
00026 boost::mpl::if_<
00027 boost::is_POD< T >,
00028 detail::through< T >,
00029 detail::destructor_caller< T > >::type::call( t );
00030 }
00031 }
00032
00033 #endif