简体   繁体   中英

Is there a way to allow this in C++ Visual Studio 2019 (Community Edition)?

(sorry if this is a noob question) Is there any way to allow fixed size C++ arrays in Visual Studio 2019 Community Edition (ie int arr[n] where n is the size I want) Thanks in advance:D

No. Variable sized arrays are not part of the C++ standard, and Visual Studio does not implement them. Use std::vector instead.

If you've done measurements that prove that this vector allocation+deallocation is a major slowdown in your app (which I've never seen happen, ever), then consider using a stack-based buffer allocator with the std::vector .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM