12 Mart 2018 Pazartesi

C++20 Modules

Module Nedir
Açıklaması şöyle
Modules are a prospective future feature of C++, and are not currently part of the language standard (i.e. not in C++17). In a nutshell, modules intended to allow you to import parsed/compiled C++ constructs rather than textually adding header files to your translation unit (which is what we currently do, using #include directives). The textual inclusion of huge amounts of header text is part of what makes C++ compilation slow; if we could compile some/most "headerish" code once, know what it offers code-wise and have the compiler remember just that (as a set of "modules"), we could tell the compiler we're using stuff from certain modules rather than including lots of headers.
Açıklaması şöyle
A module unit purview starts at the module-declaration and extends to the end of the translation unit. The purview of a named module M is the set of module unit purviews of M’s module units.
Örnek
Şöyle yaparız.
// module interface of module M
int f();
export module M;
int g();
export int h();

Hiç yorum yok:

Yorum Gönder