Jump to content
  • Advertisement
Sign in to follow this  
_WeirdCat_

Constructor + putting into an array

This topic is 986 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have such constructor







THullPolygon(float subarea, vec3 cp, vec3 A, vec3 B, vec3 C, vec3 A2, vec3 B2, vec3 C2) : submerged_area(subarea), center_point(cp),
TrisVerts[0](A), TrisVerts[1](B), TrisVerts[2](C), TrisVerts[3](A2), TrisVerts[4](B2), TrisVerts[5](C2)
{
pressure = 0.0;
pressure2 = 0.0;
tris = 2;
}

where 

vec3 TrisVerts[6];

now compiler throws ( expected at



TrisVerts[0](A), TrisVerts[1](B), TrisVerts[2](C), TrisVerts[3](A2), TrisVerts[4](B2), TrisVerts[5](C2)

but when i change that to



ka(A), kb(B), kc(C), ka2(A2), kb2(B2), kc2(C2)

where



vec3 ka, kb, kc;
vec3 ka2, kb2, kc2;

it compiles, so is there a way to initialize an array of do i have to do this by declaring 6 different vars?

Edited by WiredCat

Share this post


Link to post
Share on other sites
Advertisement

Also consider using std::array in C++11. It's an array that behaves more like a normal type, specifically without implicit pass by reference.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!