1

Possible Duplicate:
What are Aggregates and POD's and how/why are they special?

I got an error,

Non-aggregate type 'b2FixtureDef' cannot be initialized with an initializer list

during compiling this,

        b2FixtureDef    def = 
        {
            .shape      =   shape,
            .density    =   1.0f,
        }

C++ source. (Clang, Mac OS X)

What's the non-aggregate type?


The type b2FixtureDef is one of Box2D class defined as struct with default initializer.

struct b2FixtureDef
{
    b2FixtureDef()
    {
        shape = NULL;
        userData = NULL;
        friction = 0.2f;
        restitution = 0.0f;
        density = 0.0f;
        filter.categoryBits = 0x0001;
        filter.maskBits = 0xFFFF;
        filter.groupIndex = 0;
        isSensor = false;
    }
    const b2Shape* shape;
    void* userData;
    float32 friction;
    float32 restitution;
    float32 density;
    bool isSensor;
    b2Filter filter;
};
Community
  • 1
  • 1
eonil
  • 83,476
  • 81
  • 317
  • 516

0 Answers0