I am generating assembly and I want to have all the generated code aligned. This includes having sth like cout<<"\t"<<left<<setfill(' ')<< setw(8); in front of each instruction. How can I declare an ostream modifier that will save me writing all this code at every line. I am looking for sth like:
ostream mod="\t"<<left<<setfill(' ')<< setw(8);
cout<<mod<<"addiu"<<"$sp, $sp, 24"<<endl;
I know I can do this with a macro, but I want to know how I can do it with ostream object.