How can I “override” [] to accept two arguments in C++?

后端 未结 6 1201
[愿得一人]
[愿得一人] 2020-12-30 09:48

I am trying to create a bit-vector class in C++ to model some hardware. In most HDLs (hardware description langauges) that I know, specific bits are referenced like this:

6条回答
  •  梦谈多话
    2020-12-30 10:21

    Two argument operator[] is not possible in C++. The names of, precedence of, associativity of, and arity of operators is fixed by the language.1 Operator() however can take two arguments...

提交回复
热议问题