Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否有更好的方法来简单地创建一个包含具有 SIZE 的数组的结构:
... #define SIZE 100; ... struct foo { foo(); bar * bars; } foo::foo() { bars = new bar[SIZE]; }
只要SIZE是编译时常量,您就可以简单地
SIZE
struct foo { bar bars[SIZE]; }