How to zero array members when my compiler isn't standard conform

前端 未结 3 1158
独厮守ぢ
独厮守ぢ 2021-01-19 05:29

My compiler (C++Builder6) syntactically allows array member initialization (at least with zero), but actually it doesn\'t really do it. So the assert in the example given be

3条回答
  •  耶瑟儿~
    2021-01-19 05:47

    I think you may use this:

    TT() { std::fill(b, b + 8, char()); }
    

    This way you will solve your problem while nothing is wrong with portability and standard conformance!

提交回复
热议问题