Product News

docopt.cpp: A C++11 Port--Jared Grubb

A nice library to help you ship a program:

docopt.cpp: A C++11 Port

by Jared Grubb

From the article:

Isn't it awesome how getopt (and boost::program_options for you fancy folk!) generate help messages based on your code?! These timeless functions have been around for decades and have proven we don't need anything better, right?

Hell no! You know what's awesome? It's when the option parser is generated based on the beautiful help message that you write yourself! This way you don't need to write this stupid repeatable parser-code, and instead can write only the help message--the way you want it...

Cling Aims to Provide a High-performance C++ REPL--Sergio De Simone

Read about a REPL allowing to test things rapidly in C++:

Cling Aims to Provide a High-performance C++ REPL

by Sergio De Simone

From the article:

Cling is an interactive C++ interpreter that is built on top of LLVM and Clang and promises to provide a leap in productivity by going beyond the usual code-compile-run-debug C++ workflow...

Other useful materials:

Mach7: Pattern Matching for C++

Here is a new library to perform pattern matching:

Mach7: Pattern Matching for C++

by Yuriy Solodkyy, Gabriel Dos Reis and Bjarne Stroustrup

From the article:

Pattern matching is an abstraction mechanism that can greatly simplify source code. Commonly, pattern matching is built into a language to provide better syntax, faster code, correctness guarantees and improved diagnostics. Mach7 is a library solution to pattern matching in C++ that maintains many of these features. All the patterns in Mach7 are user-definable, can be stored in variables, passed among functions, and allow the use of open class hierarchies...

Example:

// Fibonacci numbers
int fib(int n)
{
    var<int> m;

    Match(n)
    {
      Case(1)     return 1;
      Case(2)     return 1;
      Case(2*m)   return sqr(fib(m+1)) - sqr(fib(m-1));
      Case(2*m+1) return sqr(fib(m+1)) + sqr(fib(m));
    }
    EndMatch
}

Breaking Changes in Visual C++

From the Visual C++ Porting and Upgrading Guide (referring to Visual Studio 2015 RC):

Breaking Changes in Visual C++

by Microsoft

From the article:

When you upgrade to a new version of the Visual C++ compiler, you might encounter compilation and/or runtime errors in code that previously compiled and ran correctly...

Bringing Clang to Windows -- Raman Sharma

Also announced this week:

Bringing Clang to Windows

by Raman Sharma

From the article:

What if you could use a single compiler for your cross-platform code irrespective of what platform you target? ...

This is now possible with the work we have done. What this enables is a scenario in which you compile ... (2) using Clang and ... the Visual C++ back-end (We call it C2).  All of this while still enjoying the rich end-to-end developer experience within Visual Studio.

Announcing Cat: a C++14 Functional Library -- Nicola Bonelli

Cat is meowingA new open source C++14 Functional Library has been released:

Cat: a C++14 Functional Library

by Nicola Bonelli

From the article:

Cat is a C++14 library, inspired by Haskell. Cat aims at pushing the functional programming approach in C++ to another level. [...] On one hand it works for filling the gap in the language with respect to functional programming. [...] On the other hand Cat promotes the use of generic programming with type classes, inspired by Category Theory.

rapidjson 1.0.0 released

Want a fast JSON parser? Check out this one…

rapidjson 1.0.0 released

From the article:

This is the final v1.0.0 release of RapidJSON.

After the v1.0-beta, a lot of efforts have been put to make RapidJSON 100% line-of-code covered by the unit tests...

GCC 5.1 released

A new version of GCC is out, with a lot of improvements:

GCC 5.1 released

Some changes:

C++

  • G++ now supports C++14 variable templates.
  • -Wnon-virtual-dtor doesn't warn anymore for final classes.
  • Excessive template instantiation depth is now a fatal error. This prevents excessive diagnostics that usually do not help to identify the problem.
  • G++ and libstdc++ now implement the feature-testing macros from Feature-testing recommendations for C++.
  • G++ now allows typename in a template template parameter.
template<template<typename> typename X> struct D; // OK
  • G++ now supports C++14 aggregates with non-static data member initializers.
struct A { int i, j = i; };
A a = { 42 }; // a.j is also 42
  • G++ now supports C++14 extended constexpr.
constexpr int f (int i)
{
  int j = 0;
  for (; i > 0; --i)
    ++j;
  return j;
}
constexpr int i = f(42); // i is 42
  • G++ now supports the C++14 sized deallocation functions.
void operator delete (void *, std::size_t) noexcept;
void operator delete[] (void *, std::size_t) noexcept;
  • A new One Definition Rule violation warning (controlled by -Wodr) detects mismatches in type definitions and virtual table contents during link-time optimization.
  • New warnings -Wsuggest-final-types and -Wsuggest-final-methods help developers to annotate programs with final specifiers (or anonymous namespaces) to improve code generation. These warnings can be used at compile time, but they are more useful in combination with link-time optimization.
  • G++ no longer supports N3639 variable length arrays, as they were removed from the C++14 working paper prior to ratification. GNU VLAs are still supported, so VLA support is now the same in C++14 mode as in C++98 and C++11 modes.
  • G++ now allows passing a non-trivially-copyable class via C varargs, which is conditionally-supported with implementation-defined semantics in the standard. This uses the same calling convention as a normal value parameter.
  • G++ now defaults to -fabi-version=0 and -fabi-compat-version=2. So various mangling bugs are fixed, but G++ will still emit aliases with the old, wrong mangling where feasible. -Wabi continues to warn about differences.
libstdc++
  • A Dual ABI is provided by the library. A new ABI is enabled by default. The old ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers.
  • A new implementation of std::string is enabled by default, using the small string optimization instead of copy-on-write reference counting.
  • A new implementation of std::list is enabled by default, with an O(1) size() function;
  • Full support for C++11, including the following new features:
    • std::deque and std::vector<bool> meet the allocator-aware container requirements;
    • movable and swappable iostream classes;
    • support for std::align and std::aligned_union;
    • type traits std::is_trivially_copyable, std::is_trivially_constructible, std::is_trivially_assignable etc.;
    • I/O manipulators std::put_time, std::get_time, std::hexfloat and std::defaultfloat;
    • generic locale-aware std::isblank;
    • locale facets for Unicode conversion;
    • atomic operations for std::shared_ptr;
    • std::notify_all_at_thread_exit() and functions for making futures ready at thread exit.
  • Support for the C++11 hexfloat manipulator changes how the num_put facet formats floating point types when ios_base::fixed|ios_base::scientific is set in a stream's fmtflags. This change affects all language modes, even though the C++98 standard gave no special meaning to that combination of flags. To prevent the use of hexadecimal notation for floating point types use str.unsetf(std::ios_base::floatfield) to clear the relevant bits in str.flags().
  • Full experimental support for C++14, including the following new features:
    • std::is_final type trait;
    • heterogeneous comparison lookup in associative containers.
    • global functions cbegin, cend, rbegin, rend, crbegin, and crend for range access to containers, arrays and initializer lists.
  • Improved experimental support for the Library Fundamentals TS, including:
    • class std::experimental::any;
    • function template std::experimental::apply;
    • function template std::experimental::sample;
    • function template std::experimental::search and related searcher types;
    • variable templates for type traits;
    • function template std::experimental::not_fn.
  • New random number distributions logistic_distribution and uniform_on_sphere_distribution as extensions.
  • GDB Xmethods for containers and std::unique_ptr.