Search⌘ K

Module Interface Unit and Module Implementation Unit

Get details about how the module interface unit and module implementation unit work.

When the module becomes bigger, you should structure it into a module interface unit and one or more module implementation units. Following the previously mentioned guidelines to structure a module, I will refactor the previous version of the math module.

Module interface unit

C++
// mathInterfaceUnit.ixx
module;
#include <vector>
export module math;
export namespace math {
int add(int fir, int sec);
int getProduct(const std::vector<int>& vec);
}
  • The module interface unit ...