Jump to content

  • Log In with Google      Sign In   
  • Create Account

too_many_stars

Member Since 29 May 2013
Offline Last Active Jun 22 2016 03:49 PM

Posts I've Made

In Topic: algorithmicly connecting a graph

22 June 2016 - 03:49 PM

Thanks ferrous and ApochPiQ, I understand it now.

 

I am beginning to think that ferrous has a good point, duplicate edges are not a big deal and might come in handy. Since it's my first time considering this problem, it did not occur to me.

 

Thanks again,

 

Mike


In Topic: algorithmicly connecting a graph

22 June 2016 - 02:47 PM

Thanks for the reply ApochPiQ,

 

My only concern with that is as the map gets bigger, the duplication checks are going to grow very quickly.


In Topic: call to new SomeClass() in func parameter

19 February 2016 - 05:05 PM

One more question that I have been wondering about.

 

Are there any practical differences between this...

void func(){
 ents.push_back(new Ent());
}

and this

void func(){
 Ent *ent=new Ent();
 ents.push_back(new Ent());

}

if in the destructor we delete all ents?

 

Thanks,

 

Mike


In Topic: call to new SomeClass() in func parameter

19 February 2016 - 03:57 PM

Thanks a bunch Josh. I will try that out.

 

Mike


In Topic: call to new SomeClass() in func parameter

19 February 2016 - 03:35 PM

Thanks again for the greatly detailed (and invaluble) response Josh.

 

I did think of using your method, for example Entity* MyClass::addEnt(), but then I considered the following problem.

class MyClass{
std::vector<Ents*> ents;

~MyClass(){
 for(auto it=ents.begin();it!=ents.end();it++)
 delete *it;
}

void addApple();
void addPear();
void addCucumber();
void add...
void addZuchini();


};

This is not my problem, just a hypothetical  one. .

 

How does one avoid bloating the functions? For example we have 200 different types of entities (just a hypothetical) is there a way to avoid 200 void addSomethings()?

 

Thanks,

 

Mike


PARTNERS