c++ 20 (auto, module)

auto

template <auto N>
auto Testfunc(auto x)
{
  auto r = N + x;
  return r;
}

// test
assert( Testfunc<1>(0.5) == 1.5 );

module

module M1;

export int add(int, int)
int add(int fir, int sec)
{
    return fir + sec;
}

int sub(int fir, int sec)
{
    return fir - sec;
}

import M1;

int main()
{

   printf("%d", add(2000, 20));

}

Related Posts