Custom manipulator for class

后端 未结 4 1671
轮回少年
轮回少年 2021-01-27 07:21

I\'m trying to write a stream manipulator with arguments. I have class with 3 int\'s CDate(Year, Month, Day). So I need to make manipulator date_format(const char*)

4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 07:32

    Manipulators with arguments don't work the same as those without arguments! The are just classes with a suitable output operator which instead of outputting a value manipulate the stream's state. To manipulate the stream state you'll probably set up a suitabe value stored with an iword() or a pword() associated with the dtream and used by the output operator.

提交回复
热议问题