Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Professional C++, 3rd Edition
| Search | Today's Posts | Mark Forums Read
BOOK: Professional C++, 3rd Edition
This is the forum to discuss the Wrox book Professional C++, 3rd Edition by Marc Gregoire,; ISBN: 978-1-118-85805-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C++, 3rd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2016, 07:06 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 7: Initializer-List Constructors example

The first example for Initializer-List Constructors doesn't seem right. Specifically, the two uses of the range for loop:

for (auto value : args) ...

for (auto value : mSequence) ...

As these are, the copy constructor is called and then the value is throw away, right?

Earlier in the page there is the NOTE: For performance reasons, it is best to pass objects by const reference instead.

Wouldn't it be better for the two range-for examples be const references?

for (const auto& value: args) ...

for (const auto& value : mSequence) ...




Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 3: Create items in Which Task List ? EDGY BOOK: Workflow in SharePoint 2010: Real World Business Workflow Solutions 1 May 19th, 2014 01:28 PM
ToDo list in ch-2 Mounika BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 January 20th, 2012 03:26 AM
ch 8 "validate against inclusion in a list" nick_rasband@byu.net BOOK: Beginning Ruby on Rails 5 July 20th, 2010 07:02 PM
Ch 4 Todo List 2 - odd behavior EricTapia BOOK: Professional Android 2 Application Development 1 March 21st, 2010 03:22 AM
Type initializer Error Prakash001 Crystal Reports 1 February 14th, 2008 02:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.