C++11 (aka C++0x) officially approved
Moderator: Coders of Rage
- TheBuzzSaw
- Chaos Rift Junior
- Posts: 310
- Joined: Wed Dec 02, 2009 3:55 pm
- Current Project: Paroxysm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Contact:
C++11 (aka C++0x) officially approved
http://www.phoronix.com/scan.php?page=n ... &px=OTc4OA
I didn't pay a ton of attention to this while it was developing. I mostly skimmed over the wiki page and thought, "Hmm, that'd be nice. Oh well." Well, it actually got approved! GCC has already implemented large chunks of it. I guess it is safe to start learning now. :P
Thoughts on this? I'm fairly excited. I hope the native thread support is actually good.
I didn't pay a ton of attention to this while it was developing. I mostly skimmed over the wiki page and thought, "Hmm, that'd be nice. Oh well." Well, it actually got approved! GCC has already implemented large chunks of it. I guess it is safe to start learning now. :P
Thoughts on this? I'm fairly excited. I hope the native thread support is actually good.
- Kyosaur
- Chaos Rift Cool Newbie
- Posts: 78
- Joined: Tue Jul 13, 2010 2:00 am
- Favorite Gaming Platforms: PS2,PS3,NDS
- Programming Language of Choice: C++
Re: C++11 (aka C++0x) officially approved
Is it sad that i dont care and am not excited for this new standard?TheBuzzSaw wrote:http://www.phoronix.com/scan.php?page=n ... &px=OTc4OA
I didn't pay a ton of attention to this while it was developing. I mostly skimmed over the wiki page and thought, "Hmm, that'd be nice. Oh well." Well, it actually got approved! GCC has already implemented large chunks of it. I guess it is safe to start learning now. :P
Thoughts on this? I'm fairly excited. I hope the native thread support is actually good.
- TheBuzzSaw
- Chaos Rift Junior
- Posts: 310
- Joined: Wed Dec 02, 2009 3:55 pm
- Current Project: Paroxysm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Contact:
Re: C++11 (aka C++0x) officially approved
Psh. Go back to your C#, heathen!
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: C++11 (aka C++0x) officially approved
I am fucking stoked for this. I was seriously considering porting my engine to GCC 4.7 just to get an early run with the new features.
- The changes to initialization are a pleasure to work with.
- The new for-loop syntax is wonderful for some more lengthy types, ie:
vs:
Code: Select all
for (std::map<uint, std::vector<uint>>::const_iterator it = items.begin(); it != items.end(); ++it)
Code: Select all
for (auto const& curr : items)
- Lambda functions are quite nice for simplifying code where you're repeating yourself a lot but don't necessarily need an entirely new function.
- Constructor delegation is something I've been wanting for a while (I don't like creating regular functions to share code between constructors).
- The changes to member initialization are very nice as well.
- I quite like the changes to enumerations, especially enums being their own namespaces. That will improve readability a lot, IMO.
- I was excited for unrestricted unions, until I messed around with them a bit and found that my Vector*D classes are still not considered simple enough to be included in a union. Still no hope for improving the organization of my Event class without sacrificing memory.
- Explicitly declared default constructors will help me resolve some ambiguity in my code. Deleted functions will be nice, too.
- STL threads are going to let me cut out some of the code I've written for doing cross-platform threading (I don't use things like Boost).
- STL regular expressions! These are going to be nice for doing quick bits of parsing that don't really warrant the inclusion of a whole 'nother library just for regex.
- STL random numbers will effectively eliminate the need for my MT19937 implementation and the supporting uniform distribution code.
- Kyosaur
- Chaos Rift Cool Newbie
- Posts: 78
- Joined: Tue Jul 13, 2010 2:00 am
- Favorite Gaming Platforms: PS2,PS3,NDS
- Programming Language of Choice: C++
Re: C++11 (aka C++0x) officially approved
lol im not a C# coder. Im just not excited for this new standard really. I know i probably SHOULD be, but its just whatever to me - nothing jumps out and excites me (i'll of course learn though).TheBuzzSaw wrote:Psh. Go back to your C#, heathen!
- MadPumpkin
- Chaos Rift Maniac
- Posts: 484
- Joined: Fri Feb 13, 2009 4:48 pm
- Current Project: Octopia
- Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
- Programming Language of Choice: C/++,Java,Py,LUA,XML
- Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk
Re: C++11 (aka C++0x) officially approved
:D hash tables <3
EDIT: I was just reading through a bunch of it, skimming the rest. It looks like 50-50 on features I'm excited for, versus not/don't care much. I love the new random generator and many other things though. Looks great I never would have known so thanks for the link.
EDIT: I was just reading through a bunch of it, skimming the rest. It looks like 50-50 on features I'm excited for, versus not/don't care much. I love the new random generator and many other things though. Looks great I never would have known so thanks for the link.
Last edited by MadPumpkin on Tue Aug 16, 2011 12:02 am, edited 1 time in total.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
For God so loved the world that he blessed the thugs with rock
-
- Chaos Rift Newbie
- Posts: 22
- Joined: Mon Mar 14, 2011 11:43 pm
- Programming Language of Choice: C++
Re: C++11 (aka C++0x) officially approved
Does anyone know of a better explanation of how lambda expressions work than the one on Wikipedia?
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: C++11 (aka C++0x) officially approved
I might be of assistance, if you were to describe exactly what you need more information on.Rapid Cube wrote:Does anyone know of a better explanation of how lambda expressions work than the one on Wikipedia?
- ismetteren
- Chaos Rift Junior
- Posts: 276
- Joined: Mon Jul 21, 2008 4:13 pm
Re: C++11 (aka C++0x) officially approved
They are just functions without a name. You often use them to pass to functions that take other functions. (higer order functions). I don't really know if this explanation is better though..Rapid Cube wrote:Does anyone know of a better explanation of how lambda expressions work than the one on Wikipedia?
-
- Chaos Rift Newbie
- Posts: 22
- Joined: Mon Mar 14, 2011 11:43 pm
- Programming Language of Choice: C++
Re: C++11 (aka C++0x) officially approved
I understand the basic concept, its just the syntax that confuses me.ismetteren wrote:They are just functions without a name. You often use them to pass to functions that take other functions. (higer order functions). I don't really know if this explanation is better though..Rapid Cube wrote:Does anyone know of a better explanation of how lambda expressions work than the one on Wikipedia?
- Nokurn
- Chaos Rift Regular
- Posts: 164
- Joined: Mon Jan 31, 2011 12:08 pm
- Favorite Gaming Platforms: PC, SNES, Dreamcast, PS2, N64
- Programming Language of Choice: Proper C++
- Location: Southern California
- Contact:
Re: C++11 (aka C++0x) officially approved
A lambda function is declared in three parts:
Or if you want to use type inference,
I think that Wikipedia sufficiently explains the specifics of storing a lambda function, so I won't write about that unless you need it explained as well.
Hope this clears some things up.
- Closures - These are variables that you want to be present in the lambda at all times. Consider closures as being like... defining the local scope for the lambda function. These exact variables will always be present in every call to the lambda, unlike parameters, which must be passed every time.
Closures are placed at the beginning of the lambda declaration, within braces, in a comma-separated list. Variables without prefixes are passed into the lambda by value, meaning that a copy of the variable is created just for the lambda. Variables prefixed by an ampersand (&) are passed into the lambda by reference, so that what you get is a reference to the variable rather than a copy. If an equal sign without a variable is given as a closure, all variables that aren't explicitly named in the closure will be passed to the lambda by value. Likewise, an ampersand without a variable will cause the same effect, but passing the variables by reference. - Parameters - If I need to explain this part, you shouldn't be thinking about lambdas yet.
- Return type - This functions largely the same way as specifying the return type of a function, with two exceptions: it comes after the parameters, and it isn't always necessary. If you have an extremely simple lambda, ie. "return something;", you can omit the type declaration, and the compiler will use its fancy new type inference to decide what the function's type should be.
Code: Select all
[closures](parameters) -> type { code }
Code: Select all
[closures](parameters) { code }
Hope this clears some things up.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: C++11 (aka C++0x) officially approved
Nothing really excites me either, just because I spend all of my time at work and play on embedded platforms whose compilers will probably never support these features.
It's almost worthless to me, to be honest.
It's almost worthless to me, to be honest.
-
- Respected Programmer
- Posts: 387
- Joined: Fri Dec 19, 2008 3:33 pm
- Location: Dallas
- Contact:
Re: C++11 (aka C++0x) officially approved
It's one of those things that language acolytes get wet over.
...It will take years to a decade or never before it sees any widespread usage in the industry.
...It will take years to a decade or never before it sees any widespread usage in the industry.