Is there any way how to set std::setw
manipulator (or its function width
) permanently? Look at this:
#include
#inc
Well, it's not possible. No way to make it call .width
each time again. But you can use boost, of course:
#include
#include
#include
#include
#include
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)
);
}
It does create its own functor, but it happens behind the scene :)