/
moduleファイルのサンプル(続き)
namespace numbers {
// ↓↓↓明示的にexportされてないので、import側では利用できない
float applyCrunchFactor(float number) {
return number * CRUNCH_FACTOR;
}
// exportキーワードを書いて、importで利用できるようにする
// (これは実装をここに書いてるパターン、他のファイルに実装を分割もできる)
export float crunch(float number) {
// 内部関数を利用
auto crunched = applyCrunchFactor(number);
// 他のmoduleの関数を利用
logger::info("Crunched {} with result of {}", number, crunche
return crunched;
}
}