Why it is impossible to create an array of references in c++?

后端 未结 4 1544
庸人自扰
庸人自扰 2020-12-25 12:08

C++ Standard 8.3.2/4 says:

There shall be no references to references, no arrays of references, and no pointers to references.

4条回答
  •  青春惊慌失措
    2020-12-25 12:32

    Because references aren't objects. References were primarily introduced to support call by reference and return by reference without inserting & at call-site. What you probably want is an array of pointers.

提交回复
热议问题