//Purpose: // Demonstrate the EBCO problem mentioned here in thread: // http://lists.boost.org/boost-users/2008/09/40552.php //Result: // Problem doesn't occur with gcc snapshot: // ftp://gcc.gnu.org/pub/gcc/snapshots/4.4-20090519/gcc-4.4-20090519.tar.bz2 // #include #include #include #include #include #include #include #include namespace boost{namespace mpl{ template < typename T , typename Inserter , unsigned Size=0 > struct insert_same_repeat /**@brief * Repeat Inserter Size times on same value, T. * * The body of this template is essentially * a copy of Steven's code in the thread * mentioned in Purpose: above. */ { // create a sequence of Size elements: typedef boost::mpl::range_c range; // convert all the elements to T with Inserter: typedef typename boost::mpl::transform , Inserter>::type type; }; }} int main() { unsigned const count=2; typedef boost::mpl::insert_same_repeat < float , boost::mpl::front_inserter > , count >::type float_container_type; float_container_type float_container_valu; std::size_t size_float=sizeof(float); std::cout << typeid(float_container_type).name() << std::endl; std::cout << "count*sizeof(float)="<