Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C++

ฟีเจอร์ C++11 ใน Visual Studio 2015

C++11 ได้รับการรับรองจาก ISO วันที่ 12 สิงหาคม 2011 Visual Studio 2015 รองรับฟีเจอร์ C++11 ส่วนใหญ่

ฟีเจอร์หลัก

  • nullptr − Literal สำหรับ Null Pointer แทน NULL/0 ป้องกัน Implicit Conversion
  • Lambdas − Anonymous Functions ใช้ได้ทุกที่ที่คาดหวัง std::function
  • auto − Type Deduction ประกาศตัวแปรไม่ต้องระบุ Type
  • Override และ Final − override บังคับ Override Virtual Function, final ห้าม Override ต่อ
  • Deleted และ Defaulted Functions − = delete ปิดการ Copy, = default ใช้ Default Implementation
  • Strongly-typed Enums − enum class ไม่ Pollute Scope
  • Static_assert และ Type Traits − Compile-time Assertion
  • Range-based For Loops − for (auto& x : container) รองรับ Foreach Paradigm

ฟีเจอร์เหล่านี้ทำให้โค้ด C++ สะดวก ปลอดภัย และทันสมัยมากขึ้น