Blog

N4332: Networking Library Proposal (Revision 3)—Christopher Kohlhoff

New WG21 papers are available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4332

Date: 2014-11-21

Networking Library Proposal (Revision 3)

by Christopher Kohlhoff

Excerpt:

1. Introduction

In the June 2014 committee meeting in Rapperswil, LEWG requested that Boost.Asio-based N2175 Networking Library Proposal for TR2 (Revision 1) be updated for C++14 and brought forward as a proposed Networking Technical Specification. This document is that revision. As well as updating the proposal for C++14, it incorporates improvements to Asio that are based on the widespread field experience accumulated since 2007.

The Boost.Asio library, from which this proposal is derived, has been deployed in numerous systems, from large (including internet-facing HTTP servers, instant messaging gateways and financial markets applications) to small (mobile phones and embedded systems). The Asio library supports, or has been ported to, many operating systems including Linux, Mac OS X, Windows (native), Windows Runtime, Solaris, FreeBSD, NetBSD, OpenBSD, HP-UX, Tru64, AIX, iOS, Android, WinCE, Symbian, vxWorks and QNX Neutrino.

2. Changes in this revision

Revision 3 addresses issues raised by LEWG in Urbana and includes the following changes:

  • String conversions and string parameters have been updated and use string_view where appropriate.
  • The header arrangement has been altered to reduce the number of header files, add a convenience header, and add a forward declarations header.
  • A diagram has been added to show the relationship between the core socket class templates.

3. Reference implementation

An almost complete implementation of the proposal text may be found in a variant of Asio that stands alone from Boost. This variant is available at https://github.com/chriskohlhoff/asio/tree/master.
 

C++14 for Qt programmers—Olivier Goffart

For those who know how to pronounce Qt, note that this title is not intended as a beauty judgment:

C++14 for Qt programmers

by Olivier Goffart

From the article:

C++14 is the name of the version of the standard to be released this year. While C++11 has brought many more feature that took time to be implemented by the compilers, C++14 is a much lighter change that is already implemented by compilers such as clang or gcc.

Qt 5 already was adapted in many ways so you can make use of the new features of C++11. You can read about that in my previous article. C++11 in Qt5. This article mention some of the changes in C++14 and the impact on Qt users...

N4320: Make exception specifications be part of the type system—Jens Maurer

New WG21 papers are available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4320

Date: 2014-11-20

Make exception specifications be part of the type system

by Jens Maurer

Excerpt:

The exception specification of a function was never considered a part of its type. Instead, 15.4 [except.spec] paragraphs 5 and 6 only restrict assignments and initializations of pointers and references to (member) functions. This leads to odd holes in the type system that have resulted in a number of core issues. ... The recent work on a specification for transactional memory support (see N4265 "Transactional Memory Support for C++: Wording (revision 3)") required integrating the transaction_safe specifier into the types of functions, among other things considering it for implicit conversions and overload resolution. This paper clones that approach to integrate the presence or absence of a non-throwing exception-specification (called noexcept) into the types of functions, too.

Quick Q: Is it idiomatic to make X objects immutable by making all X member data const?—SO

Quick A: Yes.

Recently on SO:

Idiomatic way to declare C++ immutable classes

So I have some pretty extensive functional code where the main data type is immutable structs/classes. The way I have been declaring immutability is "practically immutable" by making member variables and any methods const.

struct RockSolid {
   const float x;
   const float y;
   float MakeHarderConcrete() const { return x + y; }
}

Is this actually the way "we should do it" in C++? Or is there a better way?

N4318: Proposal to add an absolute difference function to the C++ Standard Library—J. Turnbull

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4318

Date: 2014-09-21

Proposal to add an absolute difference function to the C++ Standard Library

by Jeremy Turnbull

Excerpt:

This document proposes the addition of the abs_diff() template function to the C++ Standard Library. This function computes the absolute difference between two parameters of a type that supports the operator<() and operator-() functions, or other functions of equivalent logic, without computing a logically negative value during function execution.