123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|536|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> I've been playing with C++ vectors.

Mon, 25 Jul 2011, 19:27
steve_ancell
I've been having a little bit of fun with vectors. The remove function uses a reference, but could probably be replaced with a pointer.



Mon, 25 Jul 2011, 19:32
Cower
FYI, references are safer than pointers. If you can use a reference over a pointer, use a reference.
Mon, 25 Jul 2011, 19:37
steve_ancell
Thanx Noel, I will keep that in mind.
Tue, 26 Jul 2011, 14:26
Hotshot

references are safer than pointers.


EH? I never seen References but do you have example code of it?
Tue, 26 Jul 2011, 16:36
steve_ancell
@Hotshot: This is what a reference is, in its simple form. You create a reference by putting an '&' symbol between the type of variable and its name.



Tue, 26 Jul 2011, 16:51
Hotshot
Interesting...Much cleaner than Pointer!

What C++ IDE do you used? I used wxDev-C++
Tue, 26 Jul 2011, 16:55
steve_ancell
I've been using Visual C++ 2008, I would have used VC++ 2010, but it doesn't seem to go well with SFML.
Tue, 26 Jul 2011, 17:05
Hotshot
I see....it would cool if someone be able to do own graphics library but that would be tough task to do!
Tue, 26 Jul 2011, 17:39
shroom_monk
Steve, if you want something that goes well with SFML, I'd recommend Code::Blocks as an alternative. I've had generally good experiences with it, although the debugging tools aren't brilliant (I mean, you can get by with them, but they aren't too extensive).

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Tue, 26 Jul 2011, 18:37
steve_ancell
I'll try it out at some point, thanx shroom.
Fri, 29 Jul 2011, 08:38
Afr0
FYI, references are safer than pointers. If you can use a reference over a pointer, use a reference.


If you can, use smartpointers over both.

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Fri, 29 Jul 2011, 16:52
steve_ancell
I will have to study about those smart pointers, thanx Afr0.
Sat, 30 Jul 2011, 09:43
Hotshot
Smart Pointer look much better and more clearly
Sun, 31 Jul 2011, 04:55
Cower
If you can, use smartpointers over both.

I think you have this backwards. If you can avoid using pointers, you do so, and you pass by-reference when you need to. If you absolutely need pointers (sometimes it's just necessary, i.e., in parent-child relationships), then you should consider using a smart pointer, but make sure you're using the right kind of smart pointer (auto_ptr is deprecated in C++0x, for example). They're not magic and do not solve every problem, so it's not always a good idea to use them.
Sun, 31 Jul 2011, 15:46
Afr0
(auto_ptr is deprecated in C++0x, for example).


Do people actually use C++0x? As far as I can tell from Wikipedia, it hasn't been finalized as a standard yet.

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Sun, 31 Jul 2011, 16:37
Cower
One shouldn't use something that is soon to be deprecated. Whether C++0x is finished is irrelevant (though most compilers have already begun adding support for it), the point is more that knowing something is soon to be deprecated and still using it is a Bad Idea®.
Mon, 01 Aug 2011, 04:17
Afr0
So.... if you don't mind my asking, is anything going to replace it? Because usually there is something to replace deprecated things...

Edit: Nevermind, this topic suggests using std::unique_ptr instead!

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!