Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <iterator>
- int main( void )
- {
- int array[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256 };
- std::cout.fill( '0' );
- std::cout.flags( std::ios::hex );
- std::cout.width( 3 );
- std::copy( &array[0], &array[9], std::ostream_iterator<int>( std::cout, " " ) );
- std::cout << std::endl;
- for( int i = 0; i < 9; i++ )
- {
- std::cout.width( 3 );
- std::cout << array[i] << " ";
- }
- std::cout << std::endl;
- }
- #include <boost/function_output_iterator.hpp>
- #include <boost/lambda/lambda.hpp>
- #include <algorithm>
- #include <iostream>
- #include <iomanip>
- int main() {
- using namespace boost::lambda;
- int a[] = { 1, 2, 3, 4 };
- std::copy(a, a + 4,
- boost::make_function_output_iterator(
- var(std::cout) << std::setw(3) << _1)
- );
- }
Add Comment
Please, Sign In to add comment