- GCC 15 ने बड़ी संख्या में C++26 फीचर्स जोड़े हैं, और कुछ C++23 फीचर्स में भी सुधार किया है
- प्रमुख नई सुविधाओं में Pack Indexing, Variadic Friends, हटाने का कारण बताना, structural binding conditionals आदि शामिल हैं
- नए compiler options और warnings भी जोड़े गए हैं, जिससे developer experience बेहतर हुआ है
- C++ modules सपोर्ट को मजबूत किया गया है, और template compilation speed का optimization किया गया है
- GCC 15 को Fedora 42 के default compiler के रूप में अपनाया गया है, और जल्द ही Red Hat GCC Toolset में भी उपलब्ध कराया जाएगा
GCC 15 में C++ की नई सुविधाएँ
- GCC 15.1 को 25 अप्रैल 2025 को जारी किया गया, और इसमें C++26 फीचर्स को गंभीरता से शामिल किया गया है
- डिफ़ॉल्ट standard अभी भी
gnu++17 है, जबकि -std=c++23, -std=c++26 आदि के ज़रिए नए फीचर्स सक्षम किए जा सकते हैं
- C++20, C++23, C++26 फीचर्स अभी भी experimental हैं
C++26 की प्रमुख सुविधाएँ
-
Pack Indexing
- Variadic Template arguments में किसी खास element को
pack...[N] syntax से सीधे access किया जा सकता है
- बार-बार के tricks के बिना पहले argument आदि को साफ़ तरीके से refer किया जा सकता है
-
Structured Bindings में attributes देना
- structured binding से बने हर variable पर अलग-अलग
[[attribute]] लागू किया जा सकता है
- उदाहरण के लिए, किसी खास binding variable को ही
[[deprecated]] किया जा सकता है
-
deleted function में विवरण जोड़ना
= delete("कारण") syntax के ज़रिए deleted function call error में message दिया जा सकता है
-
Variadic Friends
- template class में कई types को एक साथ
friend घोषित किया जा सकता है
- Passkey pattern की तरह access control को मजबूत करने में उपयोगी है
-
constexpr Placement New
std::allocator और placement new को constexpr context में इस्तेमाल किया जा सकता है
-
conditionals में structured binding का उपयोग
if, while, switch conditionals के भीतर structured binding declaration संभव है
- condition evaluation compiler द्वारा बनाए गए internal variable के आधार पर होता है
-
incomplete type को delete करने पर रोक
- अगर
delete या delete[] का उपयोग incomplete type पर किया जाता है, तो C++26 mode में compile error होगा
-
Oxford comma warning
- Variadic function declaration में
, ... के बिना सिर्फ ... उपयोग करने के pattern पर C++26 में warning दी जाएगी
-
array comparison हटाया गया
- arrays के बीच
== comparison वाले code को error माना जाएगा
- पहले C++20 में यह warning थी, लेकिन अब C++26 mode में इसे compile error बना दिया गया है
-
#embed directive
- binary data को source code में सीधे शामिल करने के लिए
#embed का समर्थन
अभी कोई टिप्पणी नहीं है.