January 2013

Quick Q: If I have a T&&, why would I write std::move?—StackOverflow

Here's a common question about the relationship between && and std::move. It includes links to related variations of the question -- aka duplicates, though they're not always exact duplicates and it's helpful to see answers on different aspects of the same core question.

In C++11, why use std::move when you have &&?

I recently attended a C++11 seminar and the following tidbit of advice was given.

when you have && and you are unsure, you will almost always use std::move

Could any one explain to me why [when you already have a T&& -- Ed.] you should use std::move as opposed to some alternatives and some cases when you should not use std::move?

Pattern-Oriented Software Architectures for Concurrent and Networked Software—Doug Schmidt

A video preview is available for Doug Schmidt's upcoming free MOOC with Vanderbilt University via Coursera:

Pattern-Oriented Software Architectures for Concurrent and Networked Software

Next session: Starts March 4 (8 weeks long)

Workload: 4-6 hours/week

Douglas C. Schmidt is a Professor of Computer Science, Associate Chair of the Computer Science and Engineering program, and a Senior Researcher at the Institute for Software Integrated Systems, all at Vanderbilt University. He has also been the Chief Technology Officer for the Software Engineering Institute at Carnegie Mellon University, where he was responsible for directing the technical vision and strategic R&D investments.

C++ developers will know of Doug particularly because of his widely-acclaimed ACE and related libraries.

We asked Doug to provide an overview in his own words of what you can expect to see in the course and how it relates to C++11 in particular:

After a short ~45 minute intro to the topics covered in the course, the rest of the videos are divided into the following sections:

  • [~3 hours] Intro to concurrency and networking, which provides background info at the OS and middleware levels.  This part focuses on concepts and is largely language-neutral.
  • [~7 hours] Intro to patterns and frameworks, which provides coverage of pattern-oriented software architecture, with an emphasis on concurrent and networked software.  Small C++ and Java examples are shown throughout, though the main focus of this section is more on design techniques rather than programming, per se.
  • [~6 hours] Applying patterns and frameworks to develop concurrent and networked software, which examines *lots* of C++ code.  A high-performance HTTP web server is used as a running example to illustrate patterns and frameworks in practice.  80-90% of the focus is on C++ here, with some examples showing how you can do similar types of things in Java to demonstrate the generality of pattern and framework techniques.
  • [~3 hours] An appendix that provides an overview of C++ (including C++11 features), a case study of fundamental "Gang of Four" patterns that aren't directly related to concurrent and networked software, and other background information that may be of interest to some course participants.

Reminder: Registration deadline for spring ISO C++ meeting

Today on the committee reflector, the Bristol standards meeting host, Roger Orr, reminded us of the registration deadline.

This is also of interest to people who are not regular standards meeting. If you are in the Bristol area or otherwise interested in attending part of the standards meeting to see what's going on, you're welcome to attend -- see "How to Participate at Face-to--Face Meetings" on the Meetings and Participation page for more details.

Roger Orr writes:

Hello all, here is a reminder of booking details for the meeting.

 

Many of you have already booked for the Apr 15-20 (6-day) meeting of WG21 in Bristol, UK, and need read no further.

If you have not yet booked but are intending to come, please note that the room reservations at the hotel are time-limited. To ensure a room please book before the release date early in February.

 

  • The hotels will not claim the cost until the conference.
  • There is no time limit for registering for attendance if you are making other arrangements for accommodation.

The following link will take you to the WG21 tab of the ACCU booking site:

 

http://www.cvent.com/events/accu-2013/custom-22-09ec03b22c4f4a0a832e28126a4585fc.aspx

As mentioned in N3397the event is colocated with the ACCU conference (Apr 9-13).

You can book hotel accomodation at the time of registration: either in the conference hotel -- the Bristol City Centre  Marriott -- or the nearby Bristol Hotel (Cabot Circus) which is a little cheaper.

 

If you are only attending WG21 select registration type "WG21 conference only" in online registration.

If you are attending both the ACCU conference and the WG21 meeting you can book both at the same time (and therefore get continuous hotel room occupation) select registration type ACCU Member or ACCU Non-Member as appropriate.

 

The site also contains some tabs with information about Bristol, the hotels, and travel.

If you have any questions about Bristol please contact me (host), or Herb Sutter (convenor) as appropriate.

 

I look forward to seeing many of you in Bristol in April!

Regards,

Roger.

January standards papers mailing available

The between-meetings standards papers mailing is now available. It includes the spring meeting agenda, updated issues lists, and a number of new papers including at least one that came through the public std-proposals forum. (Update: Please also direct discussion about these papers to that forum.)

 

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup Disposition
SD-1 2013 PL22.16/WG21 document list Clark Nelson 2013-01-15 2013-01      
SD-2 ISO WG21 and INCITS PL22.16 membership list Clark Nelson 2013-01-11 2013-01      
SD-3 SC22/WG21 (C++) Study Group Organizational Information Herb Sutter 2012-10-04 2012-09      
SD-5 WG21 and PL22.16 (C++) Joint Mailing and Meeting Information Herb Sutter 2010-09-20 2012-09      
2013-01
N3493 Compile-time integer sequences Jonathan Wakely 2013-01-11 2013-01   Library Evolution  
N3494 A proposal to add special mathematical functions according to the ISO/IEC 80000-2:2009 standard Vincent Reverdy 2012-12-19 2013-01   Library Evolution  
N3495 inplace realloc Ariane van der Steldt 2012-12-07 2013-01   Library Evolution  
N3496 AGENDA, PL22.16 Meeting No. 60, WG21 Meeting No. 55, April 15-20, 2013 -- Bristol, UK Stephen D. Clamage 2013-01-02 2013-01      
N3497 Runtime-sized arrays with automatic storage duration (revision 4) Jens Maurer 2013-01-01 2013-01 N3467 Core  
N3498 Core Issue 1512: Pointer comparison vs qualification conversions (revision 2) Jens Maurer 2013-01-07 2013-01 N3478 Core  
N3499 Digit Separators Lawrence Crowl 2012-12-19 2013-01 N2281 Core  
N3500 New assert variants Olaf van der Spek 2012-11-28 2013-01   Library Evolution  
N3501 C++ Standard Core Language Active Issues, Revision 82 William M. Miller 2013-01-14 2013-01 N3480 Core  
N3502 C++ Standard Core Language Defect Reports and Accepted Issues, Revision 82 William M. Miller 2013-01-14 2013-01 N3481 Core  
N3503 C++ Standard Core Language Closed Issues, Revision 82 William M. Miller 2013-01-14 2013-01 N3482 Core  
N3505 Filesystem Library Proposal (Revision 4) Beman Dawes 2013-01-12 2013-01 N3399 Filesystem  
N3506 A printf-like Interface for the Streams Library Zhihao Yuan 2012-12-26 2013-01   Library Evolution  
N3507 A URI Library for C++ G. Matthews, D. Berris 2013-01-11 2013-01 N3484 Networking  
N3508 Any Library Proposal (Revision 2) B. Dawes, K. Henney 2013-01-11 2013-01 N3390 Library  
N3509 Operator Bool for Ranges Olaf van der Spek 2012-12-19 2013-01   Library Evolution  
N3510 std::split(): An algorithm for splitting strings Greg Miller 2013-01-10 2013-01 N3430 Library Evolution  
N3511 exchange() utility function Jeffrey Yasskin 2013-01-10 2013-01   Library Evolution  
N3512 string_ref: a non-owning reference to a string, revision 2 Jeffrey Yasskin 2013-01-11 2013-01 N3442 Library Evolution  
N3513 Range arguments for container constructors and methods, wording revision 2 Jeffrey Yasskin 2013-01-11 2013-01 N3456 Ranges  
N3514 A Proposal for the World's Dumbest Smart Pointer Walter Brown 2012-12-19 2013-01   Library Evolution  
N3515 Toward Opaque Typedefs for C++1Y Walter Brown 2013-01-11 2013-01   Evolution  
N3516 C++ Standard Library Active Issues List (Revision R81) Alisdair Meredith 2013-01-15 2013-01 N3473 Library  
N3517 C++ Standard Library Defect Report List (Revision R81) Alisdair Meredith 2013-01-15 2013-01 N3474 Library  
N3518 C++ Standard Library Closed Issues List (Revision R81) Alisdair Meredith 2013-01-15 2013-01 N3475 Library  
N3519 Feb 5, 2013 SG1 Teleconference Announcement and Agenda Hans Boehm 2013-01-11 2013-01   Concurrency  
N3520 Critical sections in vector loops Robert Geva 2013-01-11 2013-01   Concurrency  
N3521 convert() utility function Jeffrey Yasskin 2013-01-12 2013-01   Library Evolution  

 

Quick Q: How to use range-based for with std::map?—StackOverflow

A common question from the SO archives:

C++11: How to use range-based for loop with std::map?

The common example for C++0x range-based for() loops is always something simple like this:

std::vector<int> numbers = { 1, 2, 3, 4, 5, 6, 7 };

for ( auto xyz : numbers )

{

     std::cout << xyz << std::endl;

}

In which case xyz is an int. But, what happens when we have something like a map? What is the type of the variable in this example:

std::map< foo, bar > testing = { /*...blah...*/ };

for ( auto abc : testing )

{

    std::cout << abc << std::endl;         // ? should this give a foo? a bar?

    std::cout << abc->first << std::endl;  // ? or is abc an iterator?

}

When the container being traversed is something simple, it looks like range-based for() loops will give us each item, not an iterator. Which is nice...if it was iterator, first thing we'd always have to do is to dereference it anyway.

 

But I'm confused as to what to expect when it comes to things like maps and multimaps.

C++11 Rocks: Visual Studio 2012 Edition—Alex Korban

Alex Korban has written a nice e-book that covers the parts of C++11 available in Visual Studio, including documenting limitations and bugs while still focusing on how using the C++11 features makes code cleaner, safer, and faster into the bargain.

The Visual Studio 2012 edition is now in beta. See the table of contents for what's covered, and a free sample to check out the style.

C++11 Rocks: Visual Studio 2012 Edition

by Alex Korban

Highlights from the description:

Visual Studio 2012 gives you the opportunity to use C++11 features to make your code significantly cleaner and easier to read, and to improve performance as well.

But which features are there? Are they ready for use in production code? ... 

You can master the C++11 features in VS2012 with this book. It’s laser focused on C++11, Visual Studio 2012, and nothing else. You’ll quickly get in-depth knowledge of the stuff you need to know.

You’ll learn easily with tons of examples. I spent a lot of time researching and testing, and as a result the book details many C++11 bugs and cases of non-standard behavior in Visual Studio.

Continue reading...

HPX (High Performance ParalleX) 0.9.5 Released

The High Performance ParalleX (HPX) library has produced its 0.9.5 release. Here's a snippet about HPX from its release announcement.

HPX 0.9.5 Released

[...] HPX (High Performance ParalleX) is a general C++ runtime system for parallel and distributed applications of any scale. It is the first freely available, open source, feature-complete, modular, and performance oriented implementation of the ParalleX execution model. HPX is targeted at conventional architectures and, currently, Linux based systems, such as SMP nodes and conventional clusters. [...]

Continue reading...

C++ Training at All Levels—Leor Zolman

On-Site C++ Training at All Levels

by industry veteran Leor Zolman

 

Note: For a limited time, any 4- or 5-day training includes the C++11 Overview.

 

Our C++ and C seminars have been designed by some of the best-known, most effective C++ educators practicing today. In addition to materials created by Leor our C++ training repertoire features courses licensed from and supported by industry leaders Dan Saks and Stephen C. Dewhurst.

A Whirlwind Overview of C++11 (1/2-day, author: Leor Zolman)

Advanced C++  (Author: Stephen C. Dewhurst)

Effective C++ (3-, 4- and 5-day versions of courseware by Scott Meyers based on his books)

An Effective Introduction to the Standard Template Library (STL) (Author: Scott Meyers)

C++ for Non-C Programmers (Author: Leor Zolman)

C++ and Object-Oriented Programming (a.k.a. C++ for C Programmers). (Author: Dan Saks)

A sample unit of any course is available upon request.

Contact us today for more information or to schedule an on-site training at your location!