79459882

Date: 2025-02-22 16:06:31
Score: 0.5
Natty:
Report link

Just to follow on from my comment to @DominikKaszewski, I added a std::list to the class and now all the functions are generated. E.g

#include <iostream>
#include <list>

class Foo
{
public:
        Foo (int N) : values {new int[N]}{
                for (int i = 0; i < N; i++) {
                        values[i]=2*i;
                }
        };

private:
        int *values;
        std::list<double> L;
};

int main()
{
        Foo A {20};
        Foo B {A};
        Foo C {std::move(A)};

        return 0;
}

nm -C a.out | grep Foo then gives

0000000000001428 W Foo::Foo(int)
000000000000159a W Foo::Foo(Foo&&)
00000000000014ca W Foo::Foo(Foo const&)
0000000000001428 W Foo::Foo(int)
000000000000159a W Foo::Foo(Foo&&)
00000000000014ca W Foo::Foo(Foo const&)
00000000000014aa W Foo::~Foo()
00000000000014aa W Foo::~Foo()
0000000000001717 W std::remove_reference<Foo&>::type&& std::move<Foo&>(Foo&)

so it seems that he is correct and the code just gets inlined for simple classes.

Credit to @DominikKaszewski !

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @DominikKaszewski
  • User mentioned (0): @DominikKaszewski
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: TCD