Tag Archive for C++11

My Article “Advanced C++ Tips and Tools” on Amazon

My article “Advanced C++ Tips and Tools” is live on the tech.book(store) website of Amazon.

C++ allows you to write clean, safe and fast code, and writing it is even easier than ever thanks to new features in C++11. This article highlights a couple of tips…

You can read the full article here.

Share

Visual C++ November CTP, now with more C++11

As promised, Microsoft is releasing out-of-band updates for Visual C++. A preview of the first such update has now been released as the November 2012 Compiler CTP. This is a Customer Technology Preview and does not come with a ‘Go Live’ license, but it allows you to start experimenting and testing new features, and to provide feedback.

This November 2012 CTP contains a lot of new C++11 features:

  • Variadic templates
  • Uniform initialization and initializer_lists
  • Delegating constructors
  • Raw string literals
  • Explicit conversion operators
  • Default template arguments for function templates

More details, including installation instructions and how to give feedback can be found here.

Download the November 2012 CTP and start playing with these new C++11 features.

Share

The Future of C++

Herb Sutter’s talk about The Future of C++ is now available on Channel9. If you are interested in C++, you should watch it. A the same time, he announced a couple of major things related to C++:

Interest and investment in C++ continues to accelerate across the software world.

  • ISO C++ standardization is accelerating. Major companies are dedicating more people and resources to C++ standardization than they have in years. Over the next 24 months, the plan is to ship three Technical Specifications and a new C++ International Standard.
  • C++ now has a home on the web at isocpp.org. It both aggregates the best C++ content and hosts new content itself, including Bjarne Stroustrup’s new Tour of C++ and Scott Meyers’ new Universal References article.
  • There is now a Standard C++ Foundation. It is already funded by the largest companies in the industry down to startups, financial institutions to universities, book publishers to other consortia, with more members joining weekly. For the first time in C++’s history since AT&T relinquished control of the language, we have an entity – a trade organization – that exists exclusively to promote Standard C++ on all compilers and platforms, and companies are funding it because the world runs on C++, and investing in Standard C++ is good business.

This is an exciting time to be in the C++ World :)

Share

Implementing a Thread-safe Singleton with C++11

C++11 makes it easier to write a thread-safe singleton. Here is an example. The class definition of the singleton looks as follows:

#include <memory>
#include <mutex>

class CSingleton
{
public:
	virtual ~CSingleton();
	static CSingleton& GetInstance();

private:
	static std::unique_ptr<CSingleton> m_instance;
	static std::once_flag m_onceFlag;
	CSingleton(void);
	CSingleton(const CSingleton& src);
	CSingleton& operator=(const CSingleton& rhs);
};

The implementation of the GetInstance() method is very easy using C++11 std::call_once() and a lambda:

std::unique_ptr<CSingleton> CSingleton::m_instance = nullptr;
std::once_flag CSingleton::m_onceFlag;

CSingleton& CSingleton::GetInstance()
{
	std::call_once(m_onceFlag,
		[] {
			m_instance.reset(new CSingleton);
	});
	return *m_instance.get();
}
Share

GoingNative 2012 Content Available

GoingNative 2012 was a 48 hour, globally live-streamed technical event for those who push the boundaries of general purpose computing by exploiting the true capabilities of the underlying machine: C++ developers. Distinguished speakers included the creator of C++, Bjarne Stroustrup, C++ Standards Committee Chair, Herb Sutter, C++ template and big compute master, Andrei Alexandrescu, STL master Stephan T. Lavavej, LLVM/Clang developer Chandler Carruth, distributed and parallel computing expert Hans Boehm, and C++ library design expert and ISO committee member Andrew Sutton.

“C++11 feels like a new language” says C++ creator Bjarne Stroustrup, who presented the keynote at the event.

You can watch the entire GoingNative 2012 streaming video from here.

Below is a list of all individual sessions. Downloads of each individual session will come online in the coming days. These sessions are a must-see for C++ developers.

Day 1 – C++11 Today (Feb 2, 2012)

Day 2 – C++11 Today and Tomorrow (Feb 3, 2012)

Share

Slides of Presentation “C++11 (C++0x) in Visual C++ 2010″

A couple of months ago, I gave a presentation about C++11/C++0x features supported in Visual C++ 2010 for software engineers at my company. You can now download the slides.

Share

C++11 Standard Published by ISO

The ISO International Organization for Standardization has now officialy published the C++11 standard :)
Here is part of the press release:

C++, one of the most popular programming languages used in everything from Web browsers to 3D video games, has been fully updated and published as, ISO/IEC 14882:2011, Information technology – Programming languages – C++.

ISO/IEC 14882:2011 defines the programming language and specifies requirements for implementation. Also known as C++11, this is the first major revision of the standard since 1998. Its new features extend C++’s traditional strengths of flexibility and efficiency – for example, lambda functions, move semantics, and variadic templates further enable developers to use powerful expressiveness and strong abstraction to write efficient, high-performance code with full access to the hardware available when needed. Even more, the new C++11 has the convenience and ease of use of other modern languages – from features like auto type deduction and explicit virtual override control, to standard smart pointers that mean never writing delete again.

You can read the complete press release here.

Share

“Professional C++, Second Edition” Featured on the Microsoft VC++ Team Blog

My book “Professional C++, Second Edition”, published by Wiley/Wrox, is now featured in a dedicated post on the Microsoft Visual C++ Team Blog :)
Read the VC++ Team Blog post here.

Share

C++11 Now the Confirmed Name

Yesterday, I wrote a post about the fact that C++0x was unanimously approved.
Today, we got confirmation from Geneva that they will officially publish the new C++ standard in a matter of weeks with the name “ISO/IEC 14882:2011(E) Programming Languages — C++, Third Edition“, which means we can start calling it C++11

See also Herb Sutter’s update on his blog.

Now I can finalize the last pieces for my “Professional C++, Second Edition” book (Wiley/Wrox).

This is a great day for the C++ world! :)

Share

C++0x Unanimously Approved

The new C++ standard has been unanimously approved and is now an international standard.
It can still take a few months before it’s officially published, so the question still remains whether it will be called C++11 or C++12. I for sure hope it will be C++11 :)
Here is Herb Sutter’s blog post about it.

Share