It is my understanding one of the benefits of C++ modules is speedier builds I attempted to test this but am confused by the result My test consisted of the following two files I compiled the source file and observed the #pragma message generated in the exported function
foobar
as expected I then made a trivial change in the source as shown below which does not alter the call to the exported function Then upon recompiling the source I expected not to see the above mentioned #pragma message stating
foobar
is being compiled However it was in fact displayed by the compiler presumably indicating the exported module was once again being compiled for no good reason which I can see So my question is am I doing something incorrectly in order to obtain the often stated speedier builds Thank You Kindly - Cheerio
original source file:
import Foobar;
int main()
{
foobar(159);
}
module file:
export module Foobar;
export
template<typename valueType>
void foobar(valueType x)
{
#pragma message("compiling exported foobar")
}
first compile pragma message output:
compiling exported foobar
source file after insignificant change:
import Foobar;
int main()
{
foobar(159);
int x = 357;
}
second compile pragma message output:
compiling exported foobar
What I have tried:
The above explains what I tried This "What have you tried?" requirement is a nuisance