nullptr in C++11 -- FangLu
Another quick taste of C++11:
nullptr in C++11
by FangLu
Intro:
The C++11 standard introduced a new keyword,
nullptras a null pointer constant...
March 11-13, Online
March 16-18, Madrid, Spain
March 23-28, Croydon, London, UK
March 30, Kortrijk, Belgium
May 4-8, Aspen, CO, USA
May 4-8, Toronto, Canada
June 8 to 13, Brno, Czechia
June 17-20, Folkestone, UK
September 12-18, Aurora, CO, USA
November 6-8, Berlin, Germany
November 16-21, Búzios, Rio De Janeiro, Brazil
By Blog Staff | Sep 18, 2014 03:56 AM | Tags: basics
Another quick taste of C++11:
nullptr in C++11
by FangLu
Intro:
The C++11 standard introduced a new keyword,
nullptras a null pointer constant...
By Blog Staff | Sep 17, 2014 01:49 AM | Tags: advanced
Look at this image again: That's C++ in Lisp. And that's just for starters...
Embedding Lisp in C++ -- A Recipe
by Chris Kohlhepp
As a teaser, consider this from midway through the article:
Just to recap, so far we have seen C++ calling in-line Lisp; Lisp calling C++; a Lisp REPL inside of a C++ process; a full symbolic Lisp debugger inside of C++; byte compiled and interpreted mode of execution; as well as trivial Live-Programming.
We are yet to see full integration with Lisp’s package management system and fully compiled Lisp code inside of C++...
By Blog Staff | Sep 16, 2014 11:43 AM | Tags: intermediate
Recently on Tales of C++:
When Size Does Matter
by K-ballo
In the C++ lands every object has mass; for any complete type T, sizeof(T) is greater than zero. This keeps array indexing and pointer arithmetics from collapsing, but it also means that empty objects occupy space. Furthermore, when an empty object is placed in a class next to a bigger member, padding may — and in all likeliness will — be added due to alignment requirements, resulting in an empty member taking more than just one byte of storage.
Certainly something has to be done about this...
By Blog Staff | Sep 16, 2014 11:25 AM | Tags: basics
Today on Dr. Dobb's:
The C++14 Standard
by Mark Nelson
From the article:
Voting on the C++14 standard was completed in August, and all that remains before we can say it is officially complete is publication by the ISO. In this article, I will visit the high points of the new standard, demonstrating how the upcoming changes will affect the way you program, particularly when using the idioms and paradigms of Modern C++.
The committee seems intent on keeping the standards process in a higher gear than in the past. This means that C++14, having had just three years since the last standard, is a somewhat constrained release. Far from being disappointing, this is a boon for programmers because it means implementers have been able to push out compliance with the new features in real time. Yes, you can start using C++14 features today — nearly all of them if you are flexible on your tool chain...
By cbpowell | Sep 15, 2014 03:58 PM | Tags: None
I composed this review of CppCon 2014, and think it might be interesting to the ISOCPP audience.
I’ve just returned from the week-long CppCon 2014 in Bellevue, Washington. Here’s what I experienced.
I’ve absorbed a great deal from a variety of C++ developer conferences -- CppNow, Going Native, C++ And Beyond -- but always virtually, via video and webcast. This was an opportunity to jump into the thick of things and participate in person. With community heavyweights like Herb Sutter and Scott Meyers in attendance I knew the content would be stimulating and informative. (Honestly, the speaker list featured nearly every name in the “C++ royalty” that you could imagine. I smiled to myself seeing Bjarne Stroustrup standing in the registration line like he was just another attendee.) So when the conference’s early-bird admission opened in March, I eagerly sent in my hard-earned dollars and blocked off the week of September eighth on my calendar...
By Blog Staff | Sep 5, 2014 01:39 PM | Tags: intermediate c++14
A nice complement to the C++14 lambda article we linked to yesterday:
Lambda Over Lambda in C++14: The Convergence of Modern C++ on the Lisp Programming Style, Part II
by Chris Kohlhepp
From the article:
Let us see how that simplifies under C++14 and generic lambdas.
Three observations are striking immediately:
1) The use case for a template has disappeared entirely. We simply have a generic function argument x. This matches Lisp.2) The code is now entirely as brief as Lisp. Where Lisp has a lot of parenthesis, this style of coding develops a lot of “autos.”
3) The mechanics are identical also. Both functions are actually named lambdas...
By Blog Staff | Sep 4, 2014 01:32 PM | Tags: None
Building on recent C++11 lambda tutorials we've linked to recently, here's one about the brand-new lambda features in C++14:
C++14 Lambda Tutorial
by Sol
From the article:
The last iteration of C++, C++14 was approved this month. C++14 brings a few much anticipated changes to the C++11 standard, like allowing
autoto be used as the return type of a function, or generic lambdas -- the subject of this article...
By Blog Staff | Sep 4, 2014 01:24 PM | Tags: intermediate
"Are you an enum?" "Are you polymorphic?" The answers to these type questions and more are already in your C++11 standard library:
Introduction to Type Traits in the C++ standard library
by Yvonne Ma
From the article:
... As its name suggests, Type Traits exposes different characteristics of types, or simply the “type of type”. In many C++ programming practices, especially these in template metaprogramming, developers may find it difficult to build a template work for all types without knowing the characteristics of a type. That’s the key reason for the emergence of Type Trait...
By Blog Staff | Sep 4, 2014 11:46 AM | Tags: intermediate basics advanced
Here's a recent series that just got a new instalment today: It introduces template basics in a nicely explained and accessible way suitable for a gentle introduction, and then going on to progressively help the reader develop stronger template muscles.
C++ Templates series
by Feabhas
An Introduction to C++ Templates
And today: Template Specialization
From the Introduction:
Templates are a very powerful -- but often very confusing -- mechanism within C++. However, approached in stages, templates can be readily understood (despite their heinous syntax).
The aim of this series of articles is to guide beginners through the syntax and semantics of the foundation concepts in C++ template programming.
By Blog Staff | Sep 3, 2014 02:43 PM | Tags: basics
All your friends know about C++11's new stoi and to_string, right? If not, here's a quick refresher to share:
atoi and itoa conversions in C++11
by FangLu
The key reminder from the article:
... The
atoianditoaconversions in C are not very satisfying to programmers, because programmers need to deal with invalid input and exceptions to avoid worst case. On the other hand, these functions are straightforward and easy to use. So they are not rare in C++ code...In C++11, global functions, such as
std::to_string,std::stoi/stol/stollare introduced to implementatoi/itoaconversions conveniently. For example:string s; s += to_string(12) + " is int, "; s += to_string(3.14f) + " is float."; cout << s << endl;where
to_stringcan do type conversion according to the parameter type.Here is another example:
string s("12"); int i = stoi(s); cout << i << endl;