Here's a dummy example to illustrate:
class C
{
    // complex class with many fields and methods 
    // including very expensive:
    int computeA();
    int computeB();
}
struct S
{
    S(int a, int b); // initializes as {a, b, a*b};
    // how to define below constructor?
    S(const C& c); // Should be equivalent to calling S(c.computeA(), c.computeB())
    int a;
    int b;
    int ab;
}
I'm probably missing something simple but all my attempts are syntactically incorrect. I can obviously circumvent the problem by using a helper function rather than a constructor, but is there a proper way to define such constructor directly?
And of course I don't want to do this:
S(const C& c); // initialize as {c.computeA(), c.computeB(), c.computeA()*c.computeB()};
because of repeating unnecessarily expensive computations.
 
     
    