Overloading operator << - C++

后端 未结 7 1654
Happy的楠姐
Happy的楠姐 2021-02-10 07:25

Background

I have a container class which uses vector internally. I have provided a method AddChar(std::string) to this wrap

7条回答
  •  迷失自我
    2021-02-10 08:13

    This is going to make things rather confusing, I would use the same syntax as std::cin into a variable:

    std::cin >> someint;

    "First" >> container;

    This way it is at least an insertion operator. To me when anything has a << overloaded operator I expect it to be outputting something. Just like std::cout.

提交回复
热议问题