ACCU 2014 registration is open (April 8-12, Bristol, UK)
Registration is now open for ACCU 2014:
ACCU 2014
April 8-12, 2014
Bristol, UK
See the schedule's C++ highlights for 17+1 reasons for a C++ developer to attend this year.
September 13-19, Aurora, CO, USA
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Blog Staff | Jan 19, 2014 11:33 AM | Tags: intermediate basics advanced
Registration is now open for ACCU 2014:
ACCU 2014
April 8-12, 2014
Bristol, UK
See the schedule's C++ highlights for 17+1 reasons for a C++ developer to attend this year.
By Blog Staff | Jan 15, 2014 10:26 AM | Tags: intermediate
The solution to the latest GotW problem is now available:
GotW #95 Solution: Thread Safety and Synchronization
by Herb Sutter
From the article:
This GotW was written to answer a set of related frequently asked questions. So here’s a mini-FAQ on "thread safety and synchronization in a nutshell," and the points we’ll cover apply to thread safety and synchronization in pretty much any mainstream language.
By Blog Staff | Jan 14, 2014 08:49 AM | Tags: intermediate
In the current MSDN Magazine:
Using Regular Expressions with Modern C++
by Kenny Kerr
From the article:
C++11 introduced a long list of features that are in themselves quite exciting, but if all you see is a list of isolated features, then you’re missing out. The combination of these features makes C++ into the powerhouse that many have grown to appreciate. I’m going to illustrate this point by showing you how to use regular expressions with modern C++... the combination of C++ language and library features really turns C++ into a productive programming language.
By Blog Staff | Jan 13, 2014 09:40 AM | Tags: intermediate
In part 4, Andrzej wraps up his series on type erasure with a discussion and comparison of facilities in the standard library, Boost, and otherwise.
Type Erasure, Part 4
by Andrzej Krzemieński
From the article:
In this post we will be wrapping up the series on type erasure. We will see an another form of value-semantic type erasure:
boost::any
, and try to compare the different methods.
By Blog Staff | Jan 8, 2014 10:32 AM | Tags: intermediate
The solution to the latest GotW problem is now available:
GotW #7c Solution: Minimizing Compile-Time Dependencies, Part 3
by Herb Sutter
From the article:
But did you notice the curious thing about B's virtual functions?
"What?" you might say. "B has no virtual functions."
Right. That is the curious thing...
By Vittorio Romeo | Jan 6, 2014 02:48 AM | Tags: intermediate
Hello once more isocpp users, I’m Vittorio Romeo, a computer science student, hobbyist game developer and C++ enthusiast.
I’ve uploaded the fourth episode of “Dive into C++11” on my YouTube channel.
After looking at C and C++'s memory and lifetime management in part 3, we'll take a brief look at C++11 smart pointers. We will learn what they are, what problem they solve, their advantages and their uses.
The intended audience for this tutorial/screencast are people who have some experience with C++ in general, and who watched the previous episodes. This episode may be very interesting for those with experience with C++ who want to learn more about variable lifetime and memory management.
I greatly appreciate comments and criticism, and ideas for future videos/tutorials.
Feel free to fork/analyze the source code at: https://github.com/SuperV1234/Tutorials
You can find the previous episodes here:
Episode 1
Episode 2
Episode 3
Playlist
Thanks for watching!
By Blog Staff | Jan 1, 2014 07:57 AM | Tags: intermediate basics
The solution to the latest GotW problem is now available.
GotW #7b Solution: Minimizing Compile-Time Dependencies, Part 2
by Herb Sutter
From the article:
Now that the unnecessary headers have been removed, it’s time for Phase 2: How can you limit dependencies on the internals of a class?
...
Guideline: For widely-included classes whose implementations may change, or to provide ABI-safety or binary compatibility, consider using the compiler-firewall idiom (Pimpl Idiom) to hide implementation details. Use an opaque pointer (a pointer to a declared but undefined class) declared asstruct impl; std::unique_ptr<impl> pimpl;
to store private nonvirtual members.
By Blog Staff | Dec 31, 2013 10:12 AM | Tags: intermediate
Quick A: constexpr
guarantees compile-time evaluation is possible if operating on a compile-time value, and that compile-time evaluation will happen if a compile-time result is needed.
From SO, the originally worded question:
Can C++
constexpr
function actually accept non-constant expression as argument?I have defined a constexpr function as following:
constexpr int foo(int i) { return i*2; }And this is what in the main function:
int main() { int i=2; cout<<foo(i)<<endl; int arr[foo(i)]; for(int j=0;j<foo(i);j++) arr[j]=j; for(int j=0;j<foo(i);j++) cout<<arr[j]<<" "; cout<<endl; return 0; }The program was compiled under OS X 10.8 with command clang++. I was surprised that the compiler did not produce any error message about foo(i) not being a constant expression, and the compiled program actually worked fine. Why?
By Blog Staff | Dec 31, 2013 02:57 AM | Tags: intermediate
The question also has a lemon-zest touch of "templates in headers" but the basic noexcept
question is still the same:
Use of the noexcept specifier in function declaration and definition?
Consider the following function:
// Declaration in the .h file class MyClass { template <class T> void function(T&& x) const; }; // Definition in the .cpp file template <class T> void MyClass::function(T&& x) const;I want to make this function
noexcept
if the typeT
is nothrow constructible.How to do that? (I mean what is the syntax ?)
By Blog Staff | Dec 30, 2013 11:50 AM | Tags: intermediate
Quick A: Oh, yeah.
See the nice three-paragaph "highlights" answer to the question:
Does alignment really matter for performance in C++11?
There is an advice in Stroustrup's book to order the members in a struct beginning from the biggest to the smallest. But I wonder if someone has made measurements to actually see if this makes any difference, and if it is worth it to think about when writing code.