How Do I define a Double Brackets/Double Iterator Operator, Similar to Vector of Vectors'?

后端 未结 5 856
温柔的废话
温柔的废话 2020-12-08 17:29

I\'m porting code that uses a very large array of floats, which may trigger malloc failures from c to c++. I asked a question about whether I should use vectors or deques a

5条回答
  •  甜味超标
    2020-12-08 18:09

    Don't overload the [] operator, overload the () operator.

    See this link:Overloading Subscript Operator.

    I highly suggest reading through the C++ FAQ Lite at least once before posting to Stack Overflow. Also, searching Stack Overflow may yield some useful information also.

提交回复
热议问题