Sign in to follow this  
_goat

Aggregate Initialisation

Recommended Posts

My gut says no, but I hope it's wrong. I have this:
SVertexAttribute k[3] = 
	{
		{ 0, 32, FLOAT3, false, POSITION, 0 },
		{ 12, 32, FLOAT3, false, NORMAL, 0 },
		{ 24, 32, FLOAT2, false, TEXTURE, 0 }
	};
 
SStreamDescriptor s =
	{ 
		3,
		k
	};
I want something akin to this:
SStreamDescriptor s =
	{ 
		3,
		{
			{ 0, 32, FLOAT3, false, POSITION, 0 },
			{ 12, 32, FLOAT3, false, NORMAL, 0 },
			{ 24, 32, FLOAT2, false, TEXTURE, 0 }
		}
	};
Where:
struct SStreamDescriptor
{
	size_t AttributeCount;
	SVertexAttribute * Attributes;
};
 
struct SVertexAttribute
{
	// it is POD, with enums, if it matters
};
Possible at all?

Share this post


Link to post
Share on other sites
Since the Attributes member variable is pointer, your initialization should work just fine (but the second example shouldn't compile). If Attributes were an array, it wouldn't compile (but the second one would).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this