February 2013

Closer to Perfection: Get to Know C++11 Scoped and Based Enum Types -- Danny Kalev

Here's a nice intro and overview of one of the smaller features that makes C++11 safer.

Speaking of scoped and based enums, here's an interesting historical tidbit you may not know: These were initially co-proposed for C++ by an expert working on mission- and life-critical software and a large horizontal software company. Just goes to show the broad applicability of features like these, that matter where safety is critical and also help everyone.

Closer to Perfection: Get to Know C++11 Scoped and Based Enum Types

by Danny Kalev

C++ enum types pack a set of related constants in an intuitive and efficient user-defined type. Can you ask for more? With two new C++11 enhancements, namely scoped enums and based enums, the answer is "yes." Find out all about the recent facelift that C++11 enums underwent and learn how to refactor your code to benefit from the new enum features – without sacrificing performance or backward compatibility.

From the intro:

Enums are one of my favorite C++ features. They exemplify the notion of an efficient user-defined type without the heavy machinery of virtual functions, constructors, etc. (Compare C++ enums to other programming languages that still insist on using a full-blown class instead, and you’ll see what I mean.)

Yet, traditional enum types aren't flawless. ... C++11 addresses these issues with revamped enumerations that give you tighter control over the scope, size, and implicit conversions of enum types. Let's look at these new features more closely, and examine how they can improve both our code quality and frustration level.

Continue reading...

Core C++, 7 and 8 of N: Loops, ODR, and variadic array sorter

Two advanced talks by Stephan T. Lavavej (aka STL) are now available, the second being posted today:

Core C++, 7 of N

In Part 7, STL teaches us about Usual Arithmetic Conversions, Template Metaprogramming (TMP), and shares some of the Visual C++ STL internal implementation (some of it not yet released). Many of you have asked for some treatment of TMP and STL delivers!

Core C++, 8 of N

In part 8, STL digs into the do-while loop, casts, one definition rule (ODR), and his variadic template array sorter. There is a lot of information in this episode, so get comfortable, tune in, and learn.

Boost 1.53.0 Released

Release 1.53.0 of the Boost C++ Libraries is now available.

These open-source libraries work well with the C++ Standard Library, and are usable across a broad spectrum of applications. The Boost license encourages both commercial and non-commercial use.

This release contains five new libraries and numerous enhancements and bug fixes for existing libraries.

New Libraries:

  • Atomic: C++11-style atomic<>, from Helge Bahmann, maintained by Tim Blechmann.
  • Coroutine: Coroutine library, from Oliver Kowalke.
  • Lockfree: Lockfree data structures, from Tim Blechmann.
  • Multiprecision: Extended precision arithmetic types for floating point, integer and rational arithmetic from John Maddock and Christopher Kormanyos.
  • Odeint: Solving ordinary differential equations, from Karsten Ahnert and Mario Mulansky.

Links:

Thanks,

--The Boost release team

   Beman Dawes
   Daniel James
   Eric Niebler
   Marshall Clow
   Rene Rivera
   Vladimir Prus

B-Tree Containers from Google

Google has graciously gifted to the community a set of STL-like containers that use B-trees under the covers. The code has been released under the Apache 2 license.

C++ Containers That Save Memory And Time

We’re pleased to announce C++ B-Tree, a C++ template library that implements B-tree containers with an analogous interface to the standard STL map, set, multimap, and multiset containers. B-trees are well-known data structures for organizing secondary storage, because they are optimized for reading and writing large blocks of data. But the same property that makes B-trees appropriate for use with databases and file systems also makes them appropriate for use in main-memory, just with smaller blocks. [...]

Continue reading...