Читаем Thinking In C++. Volume 2: Practical Programming полностью

[63] The fact that char_traits<>::compare( ) may call strcmp( ) in one instance vs. wcscmp( ) in another, for example, is immaterial to the point we make here: the function performed by compare( ) is the same.

[64] Modern C++ Design: Generic Programming and Design Patterns Applied, Addison-Wesley, 2001.

[65] C++ Gems, edited by Stan Lippman, SIGS, 1996.

[66] Floating-point values are not compile-time constants, and therefore cannot be used in compile-time arithmetic.

[67] In 1966 Böhm and Jacopini proved that any language supporting selection and repetition, along with the ability to use an arbitrary number of variables, is equivalent to a Turing machine, which can implement any algorithm.

[68] Czarnecki and Eisenecker, Generative Programming: Methods, Tools, and Applications, Addison-Wesley, 2000, p. 417.

[69] There is a much better to compute powers of integers, of course (viz., the Russian Peasant Algorithm), but that is beside the point here.

[70] Modern C++ Design, pp. 23-26.

[71] You actually are not allowed to pass object types (other than built-ins) to an ellipsis parameter specification, but since we are only asking for its size (a compile-time operation), the expression is never actually evaluated at runtime.

[72] A reprint of Todd’s original article can be found in Lippman, C++ Gems, SIGS, 1996.

[73] See his and Nico’s book, C++ Templates, book cited earlier.

[74] Namely, Blitz++ (http://www.oonumerics.org/blitz/), the Matrix Template Library (http://www.osl.iu.edu/research/mtl/), and POOMA (http://www.acl.lanl.gov/pooma/). 

[75] We mean "vector" in the mathematical sense, as a fixed-length, one-dimensional, numerical array.

[76] Langer and Kreft, "C++ Expression Templates", C/C++ Users Journal, March 2003. See also the article on expression templates by Thomas Becker in the June 2003 issue of the same journal, and which was the inspiration for the material in this section.

[77] As explained earlier, you must explicitly instantiate a template only once per program.

[78] Visit http://www.bdsoft.com/tools/stlfilt.html.

[79] Or something that is callable as a function, as you’ll see shortly.

[80] This is simply an English rendition of O(n log n), which is the mathematical way of saying that for large n, the number of comparisons grows in direct proportion to the function f(n) = n log n.

[81] Unless you do something ungainly like use global variables.

[82] Function objects are also called functors, after a mathematical concept with similar behavior.

[83] All standard iterators define a number of nested types, including value_type, which represents the type the iterator refers to. See Chapter 7 for more detail.

[84] If a compiler were to define string::empty with default arguments (which is allowed), then the expression &string::empty would define a pointer to a member function taking the total number of arguments. Since there is no way for the compiler to provide the extra defaults, there would be a "missing argument" error when an algorithm applied string::empty via mem_fun_ref.

[85] STLPort, for instance, which comes with version 6 of Borland C++ Builder and is based on SGI STL.

[86] The stable_sort( ) algorithm uses mergesort, which is indeed stable, but tends to run slower than quicksort on average.

[87] Iterators are discussed in more depth in the next chapter.

[88] Algorithms can determine the type of an iterator by reading its tag, discussed in the next chapter.

[89] We’re ignoring the copy constructor and assignment operator in this example, since they don’t apply.

[90] Without violating any copyright laws, of course.

[91] Visit http://www.dinkumware.com, http://www.sgi.com/tech/stl, or http://www.stlport.org.

[92] The container adaptors, stack, queue, and priority_queue do not support iterators, since they do not behave as sequences from the user’s point of view.

[93] It will only work for implementations of vector that uses a pointer (a T*) as the iterator type, like STLPort does.

[94] These were actually created to abstract the "locale" facets away from iostreams, so that locale facets could operate on any sequence of characters, not only iostreams. Locales allow iostreams to easily handle culturally-different formatting (such as the representation of money) and are beyond the scope of this book.

[95] You will need to provide a char_traits specialization for any other argument type.

[96] We are indebted to Nathan Myers for explaining this.

Перейти на страницу:

Похожие книги

1С: Бухгалтерия 8 с нуля
1С: Бухгалтерия 8 с нуля

Книга содержит полное описание приемов и методов работы с программой 1С:Бухгалтерия 8. Рассматривается автоматизация всех основных участков бухгалтерии: учет наличных и безналичных денежных средств, основных средств и НМА, прихода и расхода товарно-материальных ценностей, зарплаты, производства. Описано, как вводить исходные данные, заполнять справочники и каталоги, работать с первичными документами, проводить их по учету, формировать разнообразные отчеты, выводить данные на печать, настраивать программу и использовать ее сервисные функции. Каждый урок содержит подробное описание рассматриваемой темы с детальным разбором и иллюстрированием всех этапов.Для широкого круга пользователей.

Алексей Анатольевич Гладкий

Программирование, программы, базы данных / Программное обеспечение / Бухучет и аудит / Финансы и бизнес / Книги по IT / Словари и Энциклопедии
1С: Управление торговлей 8.2
1С: Управление торговлей 8.2

Современные торговые предприятия предлагают своим клиентам широчайший ассортимент товаров, который исчисляется тысячами и десятками тысяч наименований. Причем многие позиции могут реализовываться на разных условиях: предоплата, отсрочка платежи, скидка, наценка, объем партии, и т.д. Клиенты зачастую делятся на категории – VIP-клиент, обычный клиент, постоянный клиент, мелкооптовый клиент, и т.д. Товарные позиции могут комплектоваться и разукомплектовываться, многие товары подлежат обязательной сертификации и гигиеническим исследованиям, некондиционные позиции необходимо списывать, на складах периодически должна проводиться инвентаризация, каждая компания должна иметь свою маркетинговую политику и т.д., вообщем – современное торговое предприятие представляет живой организм, находящийся в постоянном движении.Очевидно, что вся эта кипучая деятельность требует автоматизации. Для решения этой задачи существуют специальные программные средства, и в этой книге мы познакомим вам с самым популярным продуктом, предназначенным для автоматизации деятельности торгового предприятия – «1С Управление торговлей», которое реализовано на новейшей технологической платформе версии 1С 8.2.

Алексей Анатольевич Гладкий

Финансы / Программирование, программы, базы данных