ebook img

Extended STL, Volume 1: Collections and Iterators PDF

615 Pages·2007·2.85 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Extended STL, Volume 1: Collections and Iterators

Praise for Extended STL, Volume 1 “Wilson’s menu of STL treatments will no doubt be good eating for generic programming adherents, ardent C programmers just now taking on STL and C++, Java programmers taking a second look at C++, and authors of libraries targeting multiple platforms and languages. Bon appetit!” —George Frazier, Cadence Design Systems, Inc. “A thorough treatment of the details and caveats of STL extension.” —Pablo Aguilar, C++ Software Engineer “This book is not just about extending STL, it’s also about extending my thinking in C++.” —Serge Krynine, C++ Software Engineer, RailCorp Australia “You might not agree 100% with everything Wilson has to say, but as a whole his book is the most valu- able, in-depth study of practical STL-like programming.” —Thorsten Ottosen, M.C.S., Boost Contributor “Wilson is a master lion tamer, persuading multifarious third-party library beasts to jump through STL hoops. He carefully guides the reader through the design considerations, pointing out the pitfalls and making sure you don’t get your head bitten off.” —Adi Shavit, Chief Software Architect, EyeTech Co. Ltd “Wilson’s book provides more than enough information to change the angst/uncertainty level of extend- ing STL from ‘daunting’ to ‘doable.’” —Garth Lancaster, EDI/Automation Manager, Business Systems Group, MBF Australia “This book will open up your eyes and uncover just how powerful STL’s abstractions really are.” —Nevin “:-)” Liber, 19-year veteran of C++ “In the canon of C++ there are very few books that extend the craft. Wilson’s work consistently pushes the limits, showing what can and cannot be done, and the tradeoffs involved.” —John O’Halloran, Head of Software Development, Mediaproxy “Essential concepts and practices to take the working programmer beyond the standard library.” —Greg Peet “Extended STLis not just a book about adapting the STL to fit in with your everyday work, it’s also an odyssey through software design and concepts, C++ power techniques, and the perils of real-world soft- ware development—in other words, it’s a Matthew Wilson book. If you’re serious about C++, I think you should read it.” —Björn Karlsson, Principle Architect, ReadSoft; author of Beyond the C++ Standard Library: An Introduction to Boost This page intentionally left blank Extended STL, Volume 1 This page intentionally left blank Extended STL, Volume 1 Collections and Iterators Matthew Wilson Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales, (800) 382-3419, [email protected] For sales outside the United States, please contact: International Sales, [email protected] Visit us on the Web: www.awprofessional.com Library of Congress Cataloging-in-Publication Data Wilson, Matthew. Extended STL, Volume 1 : collections and iterators / Matthew Wilson. p. cm. Includes bibliographical references and index. ISBN 0-321-30550-7 (pbk. : alk. paper) 1. C++ (Computer program language) 2. Standard template library. I. Title. QA76.73.C153W55235 2007 005.13'3--dc22 2007016507 Copyright © 2007 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permis- sions, write to: Pearson Education, Inc., Rights and Contracts Department, 75 Arlington Street, Suite 300, Boston, MA 02116, Fax: (617) 848-7047 ISBN 10: 0-321-30550-7 ISBN 13: 978-0-321-30550-3 Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts. First printing, June 2007 This one’s dedicated to Uncle John, who wasn’t kidding about the second time round, and to Ben and Harry, whose “I want you to play with me, Daddy”saved me from many a hard day’s work (and meeting my first two deadlines), but mostly to My beautiful wife, Sarah, without whom little would be achievable and less would be worth the effort, whose support in a whole manner of ways exceeds even my own optimistic fancies. This page intentionally left blank Contents Preface xvii Aims xvii Subject Matter xviii Structure xix Supplementary Material xx Acknowledgments xxi Parachutes: Coda xxii About the Author xxiii Prologue xxiv A Dichotomy of Character xxiv Principles of UNIX Programming xxv Seven Signs of Successful C++ Software Libraries xxvi Balancing the Signs: Satisfiction, Dialecticism, and Idioms Old and New xxxii Example Libraries xxxiii Presentation Conventions xxxvii Fonts xxxvii . . .versus... xxxvii End Iterator Precomputation xxxviii Nested Class Type Qualification xxxix NULL xxxix Template Parameter Names xl Member and Namespace-Scope Type Names xl Calling Conventions xl Endpoint Iterators xl Namespace for Standard C Names xl Class Adaptors and Instance Adaptors xl Header File Names xli PARTONE Foundations 1 Chapter 1 The Standard Template Library 3 1.1 Core Concepts 3 1.2 Containers 4 1.3 Iterators 5 1.4 Algorithms 12 1.5 Function Objects 13 1.6 Allocators 13 ix

Description:
“Wilson’s menu of STL treatments will no doubt be good eating for generic programming adherents, ardent C programmers just now taking on STL and C++, Java programmers taking a second look at C++, and authors of libraries targeting multiple platforms and languages. Bon appetit!” --George Frazie
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.