nnolte
nnolte

Reputation: 1780

struct initialisation syntax

I stumbled over a piece of syntax that I have not seen yet and didn't find online, and I wonder what this is:

constexpr struct X{ /* define X members and methods */ } Y{};

What i don't understand is the Y{}.

Upvotes: 1

Views: 57

Answers (1)

Ivaylo Valchev
Ivaylo Valchev

Reputation: 10425

constexpr struct X{ /* something here */} Y{};

is equal to

struct X{ /* something here */};

constexpr X Y{};

For constexpr, check this documentation.

Upvotes: 2

Related Questions