کتاب الکترونیکی

Stl Tutorial and Reference Guide: C++ Programming With the Standard Template Library

Stl Tutorial & Reference Guide: C++ Programming With the Standard Template Library

دانلود کتاب Stl Tutorial & Reference Guide: C++ Programming With the Standard Template Library (به فارسی: Stl Tutorial and Reference Guide: C++ Programming With the Standard Template Library) نوشته شده توسط «David R.; Saini – Atul Musser»


اطلاعات کتاب Stl Tutorial and Reference Guide: C++ Programming With the Standard Template Library

موضوع اصلی: برنامه نویسی: زبان های برنامه نویسی

نوع: کتاب الکترونیکی

ناشر: Addison-Wesley Professional

نویسنده: David R.; Saini – Atul Musser

زبان: English

فرمت کتاب: pdf (قابل تبدیل به سایر فرمت ها)

سال انتشار: 2001

تعداد صفحه: 545

حجم کتاب: 4 مگابایت

توضیحات کتاب Stl Tutorial and Reference Guide: C++ Programming With the Standard Template Library

در سال 1968 داگ مک ایلروی مقاله معروف خود را با عنوان “مولفه های نرم افزاری تولید انبوه” ارائه کرد (مرجع 6). اکنون، با گذشت بیش از ربع قرن، ما هنوز به طور کامل به دیدگاه او در مورد کتابخانه های استاندارد اجزای قابل استفاده مجدد (که امروزه به عنوان “بلوک های سازنده نرم افزار” یا “آی سی های نرم افزار” نیز شناخته می شوند، نرسیده ایم. در برخی زمینه‌ها مانند محاسبات عددی و آماری، سنت طولانی استفاده از کتابخانه‌های استاندارد به جای نوشتن کد منبع کاملاً از ابتدا وجود دارد، اما در بسیاری از حوزه‌های دیگر، استانداردسازی رخ نداده است. حتی در حوزه ساختارهای داده بنیادی و الگوریتم‌های پردازش داده، جایی که شاید بیشترین مزیت بالقوه از استانداردسازی مؤلفه‌ها و استفاده گسترده از مؤلفه‌ها وجود دارد، هیچ مجموعه‌ای از مؤلفه‌ها پدیدار نشده و توسط تعداد زیادی از برنامه‌نویسان یا مدیران توسعه نرم‌افزار پذیرفته شده است. با نبود مجموعه ای استاندارد از چنین ساختار داده و اجزای الگوریتمی، برنامه نویسان مجبور شده اند همه چیز را از ابتدا برنامه ریزی کنند یا یکی از چندین بسته تجاری را اتخاذ کنند. در حالی که نوشتن همه چیز از ابتدا اغلب به برنامه نویسان حس کنترل می دهد، اما منبع ناامیدی نیز است، زیرا به ندرت زمانی برای پیاده سازی بهترین تکنیک ها وجود دارد، حتی با فرض اینکه برنامه نویس از قبل آنها را شناخته باشد. و کتابخانه های تجاری موجود از اشکالات متعددی رنج می برند. برای مثال، در قلمرو C++، مشکلات عبارتند از Incompatibility: رابط‌های کلاس‌های ارائه‌شده توسط فروشنده‌های مختلف همواره متفاوت هستند، و نوشتن کد قابل حمل را دشوار می‌سازد. ناکارآمدی: پیاده‌سازی اکثر کتابخانه‌های مؤلفه‌های تجاری موجود معمولاً شامل سلسله مراتب کلاس‌های پیچیده با استفاده گسترده است. توابع وراثت و مجازی در نتیجه، استفاده از این مؤلفه‌ها منجر به برنامه‌هایی با کارایی قابل توجهی کمتر از آنچه در رابط‌های C نوشته می‌شود، می‌شود. علاوه بر اینکه اضافه کردن عملیات جدید بدون کامپایل مجدد کد را برای برنامه نویسان دشوار می کند، این امر باعث می شود که اینترفیس ها بی دلیل بزرگ شوند. تا به حال. کتابخانه قالب استاندارد هم پیشرفت قابل توجهی در روش برنامه نویسی است و هم بخشی کاملاً پذیرفته شده از کتابخانه استاندارد C++. انتظار اینکه اجزای STL به یکی از پرکاربردترین نرم افزارهای موجود تبدیل شوند، چندان خوش بینانه به نظر نمی رسد. دلایل آن پنج مورد است: C++ در حال تبدیل شدن به یکی از پرکاربردترین زبان های برنامه نویسی است (که تا حد زیادی به دلیل پشتیبانی از ساخت و استفاده از کتابخانه های مؤلفه است). کتابخانه‌های آن، فروشندگان کامپایلر آن را بخشی از توزیع‌های استاندارد خود می‌سازند. همه مؤلفه‌ها در STL عمومی هستند، به این معنی که آن‌ها (با زبان پشتیبانی شده و تکنیک‌های زمان کامپایل) برای کاربردهای مختلف قابل انطباق هستند. عمومیت مؤلفه‌های STL به دست آمده است. بدون به خطر انداختن کارایی. طراحی اجزای STL به عنوان بلوک های ساختمانی ریزدانه و قابل تعویض، آنها را به پایه ای مناسب برای توسعه بیشتر مؤلفه ها برای حوزه های تخصصی مانند پایگاه های داده، رابط های کاربری و غیره تبدیل می کند. تقریباً همه برنامه نویسان ++C می دانند که منشاء این زبان مدیون یک نفر به نام بیارن استروستروپ است که از اوایل سال 1979 شروع به توسعه زبان C برای پشتیبانی از تعریف کلاس ها و اشیا کرد. شخص، الکساندر استپانوف. جالب است که همچنین در سال 1979، تقریباً همزمان با تحقیقات اولیه استروستروپ، الکس شروع به کار کردن ایده های اولیه خود در مورد برنامه نویسی عمومی و کشف پتانسیل آنها برای ایجاد تحول در توسعه نرم افزار کرد. اگرچه یکی از نویسندگان این کتاب (D.R.M.) برخی از جنبه های برنامه نویسی عمومی را در اوایل سال 1971 توسعه داده و از آن حمایت کرده بود، اما به حوزه نسبتاً تخصصی توسعه نرم افزار (جبر رایانه ای) محدود شد. این الکس بود که پتانسیل کامل برنامه نویسی عمومی را تشخیص داد و همکاران آن زمان خود در تحقیق و توسعه جنرال الکتریک (از جمله، در درجه اول، D.R.M. و Deepak Kapur) را متقاعد کرد که برنامه نویسی عمومی باید به عنوان پایه ای جامع برای توسعه نرم افزار دنبال شود. اما در آن زمان هیچ پشتیبانی واقعی در هیچ زبان برنامه نویسی برای برنامه نویسی عمومی وجود نداشت. اولین زبان اصلی که چنین پشتیبانی را ارائه کرد Ada بود و تا سال 1987 Alex و D.R.M. یک کتابخانه Ada را برای پردازش لیست ایجاد و منتشر کرده بود که نتایج بسیاری از تحقیقات آنها در مورد برنامه نویسی عمومی را در بر می گرفت. با این حال، Ada در خارج از صنعت دفاعی به مقبولیت زیادی دست نیافته بود، و C++ برای استفاده گسترده و ارائه پشتیبانی خوب از برنامه نویسی عمومی، حتی اگر زبان نسبتاً نابالغ بود، گزینه بهتری به نظر می رسید.


In 1968 Doug McIlroy presented his famous paper, “Mass Produced Software Components” (Ref. 6). Now, more than a quarter of a century later, we still have not fully realized his vision of standard libraries of reusable components (which today are also known as “software building blocks” or “software ICs”). In some areas such as numerical and statistical computation, there is a long tradition of heavy use of standard libraries, rather than writing source code entirely from scratch, but in many other areas, standardization hasn’t occurred. Even in the area of fundamental data structures and data-processing algorithms, where there is perhaps the greatest potential benefit from component standardization and widespread component use, no set of components has emerged and been embraced by large numbers of programmers or software development managers.In the absence of a standard set of such data structure and algorithm components, programmers have been forced either to program everything from scratch or to adopt one of several commercial packages. While writing everything from scratch often gives programmers a sense of control, it is also a source of frustration, since there is rarely time to implement the best techniques, even assuming they are already known to the programmer. And the available commercial libraries have suffered from several drawbacks. In the C++ realm, for example, the problems includeIncompatibility: The interfaces of classes supplied by various vendors are invariably different, making it difficult to write portable code.Inefficiency: The implementations of most commercially available components libraries typically involve complex class hierarchies with extensive use of inheritance and virtual functions. As a result, using these components results in significantly less-efficient programs than could be written in C.Unwieldy interfaces: In most component libraries, all operations to be performed on a data structure are part of the interface of the class defining it. Besides making it difficult for programmers to add new operations without recompiling the code, this makes the interfaces needlessly large.These problems have been widely recognized for many years, but few solutions have been proposed and none has been widely embraced – not, that is, until now. The Standard Template Library is both a remarkable advance in programming methodology and a fully accepted part of the C++ Standard Library. It does not seem overly optimistic to expect that STL components will become some of the most widely used software in existence. The reasons are fivefold:C++ is becoming one of the most widely used programming languages (which is in large part due to the support it provides for building and using component libraries).Since STL has been incorporated into the ANSI/ISO standard for C++ and its libraries, compiler vendors are making it part of their standard distributions.All components in STL are generic, meaning that they are adaptable (by language-supported, compile-time techniques) to many different uses.The generality of STL components has been achieved without sacrificing efficiency.The design of STL components as fine-grained, interchangeable building blocks makes them a suitable basis for further development of components for specialized areas such as databases, user interfaces, and so forth.Virtually all C++ programmers know that the origin of this language is due to one person, Bjarne Stroustrup, who began thinking of how to extend the C language to support definition of classes and objects as early as 1979. So too it is the case that the architecture of STL is largely the creation of one person, Alexander Stepanov.It is interesting that it was also in 1979, at about the same time as Stroustrup’s initial research, that Alex began working out his initial ideas of generic programming and exploring their potential for revolutionizing software development. Although one of this book’s authors (D.R.M.) had developed and advocated some aspects of generic programming as early as 1971, it was limited to a rather specialized area of software development (computer algebra). It was Alex who recognized the full potential for generic programming and persuaded his then-colleagues at General Electric Research and Development (including, primarily, D.R.M. and Deepak Kapur) that generic programming should be pursued as a comprehensive basis for software development. But at that time there was no real support in any programming language for generic programming. The first major language to provide such support was Ada, and by 1987 Alex and D.R.M. had developed and published an Ada library for list processing that embodied the results of much of their research on generic programming. However, Ada had not achieved much acceptance outside of the defense industry, and C++ seemed like a better bet for both becoming widely used and providing good support for generic programming, even though the language was relatively immature (it did not even have templates, which were added only later). Another reason for turning to C++, which Alex recognized early on, was that the C/C++ model of computation, which allows very flexible access to storage (via pointers) is crucial to achieving generality without losing efficiency.Still, much research and experimentation were needed, not just to develop individual components, but more importantly to develop an overall architecture for a component library based on generic programming. First at AT&T Bell Laboratories and later at Hewlett-Packard Research Labs, Alex experimented with many architectural and algorithm formulations, first in C and later in C++. D.R.M. collaborated in this research, and in 1992 Meng Lee joined Alex’s project at HP and became a major contributor.This work likely would have continued for some time just as a research project, or at best would have resulted in an HP-proprietary library, if Andrew Koenig of Bell Labs had not become aware of the work and asked Alex to present the main ideas at a November 1993 meeting of the ANSI/ISO committee for C++ standardization. The committee’s response was overwhelmingly favorable and led to a request from Koenig for a formal proposal in time for the March 1994 meeting. Despite the tremendous time-pressure, Alex and Meng were able to produce a draft proposal that received preliminary approval at that meeting.The committee had several requests for changes and extensions (some of them major), and a small group of committee members met with Alex and Meng to help work out the details. The requirements for the most significant extension (associative containers) had to be shown to be consistent by fully implementing them, a task Alex delegated to D.R.M. It would have been quite easy for the whole enterprise to spin out of control at this point, but again Alex and Meng met the challenge and produced a proposal that received final approval at the July 1994 ANSI/ISO committee meeting. (Additional details of this history can be found in an interview Alex gave in the March 1995 issue of Dr. Dobbs Journal.)Subsequently, the Stepanov and Lee document (Ref. 10) has been incorporated almost intact into the ANSI/ISO C++ draft standard (Ref. 1, parts of clauses 17 through 27). It also has influenced other parts of the C++ Standard Library, such as the string facilities, and some of the previously adopted standards in those areas have been revised accordingly.In spite of STL’s success with the committee, there remained the question of how STL would make its way into actual availability and use. With the STL requirements part of the publicly available draft standard, compiler vendors and independent software library vendors could of course develop their own implementations and market them as separate products or as selling points for their other wares. One of this book’s authors (A.S.) was among the first to recognize the commercial potential and began exploring it as a line of business for his company, Modena Software Incorporated, even before STL had been fully accepted by the committee.The prospects for early widespread dissemination of STL were considerably improved with Hewlett-Packard’s decision to make its implementation freely available on the Internet in August 1994. This implementation, developed by Stepanov, Lee, and D.R.M. during the standardization process, is the basis of Modena’s STL++ product and several other vendors’ offerings; it is referred to in this book as the “HP reference implementation. The Stepanov and Lee document, while precise and complete, was aimed more at the committee than at the wide audience of C++ programmers. Along with modifying the HP reference implementation to work well with several compilers and providing several additional classes, Modena developed the STL++ Manual, the first comprehensive user-level documentation of STL. (D.R.M. served as an advisor to Modena and was the principal author of the Tutorial section of the STL++ Manual.) We recognized, though, that an even more comprehensive treatment of STL was needed, one that would have better and more complete coverage of all aspects of the library. With much encouragement and assistance from our editor, Mike Hendrickson, we have attempted to meet this goal with the present book.With the publication of this book, Modena and Addison-Wesley are also making available on the Internet all of the source code for examples used in this book, so that readers who want to try them do not have to type them. Instructions for finding and retrieving all of this material can be found in Appendix B.We do not want to give the impression that we believe STL is the solution to all programming problems. There are potentially still some bumps in the road to its acceptance by the broad programming community, such as compiler weaknesses and the usual opportunities for misunderstanding of a radically new approach. We hope this book will make the road for STL itself as smooth as possible, but of course there are still many fundamental data structures and algorithms that are not covered. Beyond this realm, there are many more specialized areas of computation that also cry out for component standardization. References 3 and 7 discuss the larger view in some detail. We hope that among our readers will be some who have the vision and resources to continue in the direction that STL has opened up, carrying on its ideas to other component libraries, not only in C++ but also in other programming languages.Although in the larger scheme of things it is just a small step toward realizing McIlroy’s original vision (Ref. 6), STL is a remarkable achievement and has the potential for revolutionizing the way a large number of people program. We hope this book helps you become a full participant in that revolution.We gratefully acknowledge the encouragement and assistance of many people. First and foremost, Alex Stepanov and Meng Lee offered continuous encouragement and were always available to help straighten out any misconceptions we had about the design of the library. Invaluable assistance with code development and testing was provided by several Modena staff members, including Atul Gupta, Kolachala Kalyan, and Narasimhan Rampalli. Several reviewers of earlier drafts gave us much valuable feedback and helped us find ways to present the most crucial ideas more clearly. They include Mike Ballantyne, Tom Cargill, Edgar Chrisostomo, Brian Kernighan, Scott Meyers, Larry Podmolik, Kathy Stark, Steve Vinoski, and John Vlissides. Others who also made valuable suggestions include Dan Benanav, Bob Cook, Bob Ingalls, Nathan Schimke, Kedar Tupil, and Rick Wilhelm. Finally, we thank the team at Addison-Wesley for their expert editorial and production assistance: Kim Dawley, Katie Duffy, Rosa Gonzalez, Mike Hendrickson, Simone Payment, Avanda Peters, John Wait, and Pamela Yee.

دانلود کتاب «Stl Tutorial and Reference Guide: C++ Programming With the Standard Template Library»

مبلغی که بابت خرید کتاب می‌پردازیم به مراتب پایین‌تر از هزینه‌هایی است که در آینده بابت نخواندن آن خواهیم پرداخت.

برای دریافت کد تخفیف ۲۰ درصدی این کتاب، ابتدا صفحه اینستاگرام کازرون آنلاین (@kazerun.online ) را دنبال کنید. سپس، کلمه «بلیان» را در دایرکت ارسال کنید تا کد تخفیف به شما ارسال شود.