C++ initialize anonymous struct

Viewed 11392

I'm still earning my C++ wings; My question is if I have a struct like so:

struct Height
{
    int feet;
    int inches;
};

And I then have some lines like so:

Height h = {5, 7};
Person p("John Doe", 42, "Blonde", "Blue", h);

I like the initialization of structs via curly braces, but I'd prefer the above be on one line, in an anonymous Height struct. How do I do this? My initial naive approach was:

Person p("John Doe", 42, "Blonde", "Blue", Height{5,7});

This didn't work though. Am I very far off the mark?

2 Answers
Related