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.
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 | 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 15, 2014 09:08 AM | Tags: None
Conference chair Jon Jagger has published the conference schedule and session abstracts for ACCU 2014.
ACCU 2014 Conference Schedule
Follow conference news via @accu2014 on Twitter.
Some highlights of this year's schedule include a number of C++ talks. Most of the following speakers are ISO C++ committee members:
Switching to C++11 and C++14 in One Day (Nico Josuttis)
C++14 -- An Overview of the New Standard for C++(11) Programmers (Peter Sommerlad)
There Ain't No Such Thing As a Universal Reference (Jonathan Wakely)
The C++14 Standard Library (Jonathan Wakely)
C++ Dynamic Performance (Aleksandar Fabijanic)
C++ Undefined Behavior -- What Is It, and Why Should I Care? (Marshall Clow)
Large-Scale C++ -- Advanced Levelization Techniques (John Lakos)
C++ Pub Quiz (Olve Maudal)
Creating Safe Multi-Threaded Applications in C++11 (Jos van Eijndhoven)
Random Number Generation in C++ -- Present and Potential Future (Pattabi Raman)
Range and Elevation -- C++ In a Modern World (Steve Love)
Generic Programming with Concepts Lite (Andrew Sutton)
Where Is C++ Headed? (Hubert Matthews)
Complementary Visions: Integrating C++ and Python with Boost.Python (Austin Bingham)
The Continuing Future of C++ Concurrency (Anthony Williams)
Polymorphic Allocators for Fundamental Libraries (Alisdair Meredith)
Executors for C++ (Detlef Vollmann)
Endnote: Everything You Ever Wanted To Know About Move Semantics (and then some) (Howard Hinnant)
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 14, 2014 06:54 AM | Tags: None
Quick A: Use a template alias. Several standard ones are coming in C++14.
Recently on SO:
How can I avoid writing
::valueand::typewhen usingstd::enable_if? [cppx]In some of my code, namely the header
rfc/cppx/text/String.h, I found the following mysterious snippet:template< class S, class enable = CPPX_IF_( Is_a_< String, S > ) > void operator! ( S const& ) { string_detail::Meaningless::operation(); }The
operator!is in support of aStringclass that has an implicit conversion to raw pointer. So I overload (among others)operator!for this class and derived classes, so that inadvertent use of a non-supported operator will give a suitable compilation error, mentioning that it's meaningless and inaccessible. Which I think is much preferable to such usage being silently accepted with an unexpected, incorrect result.The
CPPX_IF_macro supports Visual C++ 12.0 (2013) and earlier, which finds C++11 using to be mostly beyond its ken. For a more standard-conforming compiler I would have written just ...template< class S, class enable = If_< Is_a_< String, S > > > void operator! ( S const& ) { string_detail::Meaningless::operation(); }This looks like
std::enable_if,template< class S, class enabled = typename std::enable_if< Is_a_< String, S >::value, void >::type > void operator! ( S const& ) { string_detail::Meaningless::operation(); }except that the
If_orCPPX_IF_, and its expression, is much more concise and readable.How on Earth did I do that?
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 13, 2014 01:47 AM | Tags: basics
Quick A: It's a good style by default when you know you'll keep a copy of the parameter anyway. If you have an expensive-to-move type or otherwise want additional control, you can overload on &/&& or else perfect-forward.
Recently on SO:
Is the pass-by-value-and-then-move construct a bad idiom?
Since we have move semantincs in C++, nowadays it is usual to do
void set_a(A a) { _a = std::move(a); }The reasoning is that if
ais an rvalue, the copy will be elided and there will be just one move.But what happens if
ais an lvalue? It seems there will be a copy construction and then a move assignment (assumingAhas a proper move assignment operator). Move assignments can be costly if the object has too many member variables.On the other hand, if we do
void set_a(const A& a) { _a = a; }There will be just one copy assignment. Can we say this way is preferred over the pass-by-value idiom if we will pass lvalues?
By Blog Staff | Jan 10, 2014 12:47 PM | Tags: basics
Quick A: Because it's more efficient, since it can eliminate an additional allocation.
Recently on SO:
Difference in make_shared and normal shared_ptr in C++
std::shared_ptr<Object> p1 = std::make_shared<Object>("foo"); std::shared_ptr<Object> p2(new Object("foo"));Many google and stackoverflow posts are there on this, but I am not able to understand why
make_sharedis more efficient than directly usingshared_ptr. Can someone explain me step by step sequence of objects created and operations done by both so that I will be able to understand howmake_sharedis efficient. I have given one example above for reference.
By Blog Staff | Jan 10, 2014 11:37 AM | Tags: basics
Quick A: Yes, and we do!
Recently on SO -- the selected answer is the correct one:
Is it possible to have automatically generated destructors in C++?
It is too big burden to do it by ourselves all the time. Is it so hard for the compiler to generate destructors? Can't it detect what is a "resource" and release it in the destructor?
By Blog Staff | Jan 10, 2014 10:30 AM | Tags: basics
Jens's latest, following up on his pointers post:
An overview on smart pointers
by Jens Weller
From the article:
So, a smart pointer is only needed, when you use new or other means of dynamic memory allocation. In my opinion, you should prefer to allocate variables on the stack, so when refactoring code (to C++11), you should always ask yourself, if this
newis needed, or could be replaced with an object on the stack. When you need to usenew, you should always use a smart pointer in my opinion. Also some smart pointers offer a custom deleter, which is handy if you have an object that is either not allocated bynewand/or needs to be freed by calling a special function.