Question about storing array in a std::vector in C++

前端 未结 7 1360
灰色年华
灰色年华 2021-01-12 17:07

I am unclear about the following.

First, this code compiles fine:

#include 

typedef struct{
    int x1,x2,x3,x4;
}  ints;

typedef std         


        
7条回答
  •  梦谈多话
    2021-01-12 17:35

    Arrays are not first class in C++; you cannot pass them as arguments to functions, for example (they decay to pointers, although you can pass pointers and references to arrays). Further, they do not have value semantics.

提交回复
热议问题