Misplaced Pages

C++ Standard Library

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

In object-oriented programming , a class defines the shared aspects of objects created from the class. The capabilities of a class differ between programming languages , but generally the shared aspects consist of state ( variables ) and behavior ( methods ) that are each either associated with a particular object or with all objects of that class.

#865134

75-656: In the C++ programming language, the C++ Standard Library is a collection of classes and functions , which are written in the core language and part of the C++ ISO Standard itself. The C++ Standard Library provides several generic containers, functions to use and manipulate these containers, function objects, generic strings and streams (including interactive and file I/O), support for some language features, and functions for common tasks such as finding

150-860: A .def extension may denote files designed to be included multiple times, each time expanding the same repetitive content; #include "icon.xbm" is likely to refer to an XBM image file (which is at the same time a C source file). #include often compels the use of #include guards or #pragma once to prevent double inclusion. The if–else directives #if , #ifdef , #ifndef , #else , #elif , and #endif can be used for conditional compilation . #ifdef and #ifndef are simple shorthands for #if defined(...) and #if !defined(...) . Most compilers targeting Microsoft Windows implicitly define _WIN32 . This allows code, including preprocessor commands, to compile only when targeting Windows systems. A few compilers define WIN32 instead. For such compilers that do not implicitly define

225-467: A constructor and a destructor . An object expresses data type as an interface – the type of each member variable and the signature of each member function (method). A class defines an implementation of an interface, and instantiating the class results in an object that exposes the implementation via the interface. In the terms of type theory, a class is an implementation‍—‌a concrete data structure and collection of subroutines‍—‌while

300-603: A UITableView is a UIScrollView is a UIView is a UIResponder is an NSObject. In object-oriented analysis and in Unified Modelling Language (UML), an association between two classes represents a collaboration between the classes or their corresponding instances. Associations have direction; for example, a bi-directional association between two classes indicates that both of the classes are aware of their relationship. Associations may be labeled according to their name or purpose. An association role

375-445: A button, and all the buttons together compose the interface (other television sets that are the same model as yours would have the same interface). In its most common form, an interface is a specification of a group of related methods without any associated implementation of the methods. A television set also has a myriad of attributes , such as size and whether it supports color, which together comprise its structure. A class represents

450-405: A class from its interface: the internal structure is made private, while public accessor methods can be used to inspect or alter such private data. Access specifiers do not necessarily control visibility , in that even private members may be visible to client external code. In some languages, an inaccessible but visible member may be referred to at runtime (for example, by a pointer returned from

525-422: A collection of objects, such as instances of Body , Engine , Tires , etc. Object modeling languages such as UML include capabilities to model various aspects of "part of" and other kinds of relations – data such as the cardinality of the objects, constraints on input and output values, etc. This information can be utilized by developer tools to generate additional code besides the basic data definitions for

600-501: A concrete sub class. An abstract class is either labeled as such explicitly or it may simply specify abstract methods (or virtual methods ). An abstract class may provide implementations of some methods, and may also specify virtual methods via signatures that are to be implemented by direct or indirect descendants of the abstract class. Before a class derived from an abstract class can be instantiated, all abstract methods of its parent classes must be implemented by some class in

675-438: A facility that allows the programmer to define where include files can be found. This can be introduced through a command-line flag, which can be parameterized using a makefile , so that a different set of include files can be swapped in for different operating systems, for instance. By convention, include files are named with either a .h or .hpp extension. However, there is no requirement that this be observed. Files with

750-437: A function-like macro is: This defines a radians -to-degrees conversion which can be inserted in the code where required; for example, RADTODEG(34) . This is expanded in-place, so that repeated multiplication by the constant is not shown throughout the code. The macro here is written as all uppercase to emphasize that it is a macro, not a compiled function. The second x is enclosed in its own pair of parentheses to avoid

825-504: A member function), but an attempt to use it by referring to the name of the member from the client code will be prevented by the type checker. The various object-oriented programming languages enforce member accessibility and visibility to various degrees, and depending on the language's type system and compilation policies, enforced at either compile time or runtime . For example, the Java language does not allow client code that accesses

SECTION 10

#1732781099866

900-475: A pointer to the number is required, is to apply the const qualifier to a global variable. This causes the value to be stored in memory, instead of being substituted by the preprocessor. However, in modern C++ code, the constexpr keyword, introduced in C++11 , is used instead: Usages of variables declared as constexpr , as object-like macros, may be replaced with their value at compile-time. An example of

975-421: A superclass of Rectangle and Ellipse , while Square would be a subclass of Rectangle . These are all subset relations in set theory as well, i.e., all squares are rectangles but not all rectangles are squares. A common conceptual error is to mistake a part of relation with a subclass. For example, a car and truck are both kinds of vehicles and it would be appropriate to model them as subclasses of

1050-601: A type is an interface . Different (concrete) classes can produce objects of the same (abstract) type (depending on type system). For example, the type (interface) Stack might be implemented by SmallStack that is fast for small stacks but scales poorly and ScalableStack that scales well but has high overhead for small stacks. A class contains data field descriptions (or properties , fields , data members , or attributes ). These are usually field types and names that will be associated with state variables at program run time; these state variables either belong to

1125-407: A variable number of parameters, such as printf , for example when logging warnings and errors. One little-known usage pattern of the C preprocessor is known as X-Macros . An X-Macro is a header file . Commonly, these use the extension .def instead of the traditional .h . This file contains a list of similar macro calls, which can be referred to as "component macros." The include file

1200-416: A variety of Fortran languages. The preprocessor provides inclusion of header files , macro expansions, conditional compilation , and line control. The language of preprocessor directives is only weakly related to the grammar of C, and so is sometimes used to process other kinds of text files . The preprocessor was introduced to C around 1973 at the urging of Alan Snyder and also in recognition of

1275-491: A vehicle class. However, it would be an error to model the parts of the car as subclass relations. For example, a car is composed of an engine and body, but it would not be appropriate to model an engine or body as a subclass of a car. In object-oriented modeling these kinds of relations are typically modeled as object properties. In this example, the Car class would have a property called parts . parts would be typed to hold

1350-420: Is a sub-class , and the class it is based on is its superclass . As an instance of a class, an object is constructed from a class via instantiation . Memory is allocated and initialized for the object state and a reference to the object is provided to consuming code. The object is usable until it is destroyed – its state memory is de-allocated. Most languages allow for custom logic at lifecycle events via

1425-407: Is a common set of access specifiers : Although many object-oriented languages support the above access specifiers,their semantics may differ. Object-oriented design uses the access specifiers in conjunction with careful design of public method implementations to enforce class invariants—constraints on the state of the objects. A common usage of access specifiers is to separate the internal data of

1500-653: Is a strict superset of the other. A noteworthy feature of the C++ Standard Library is that it not only specifies the syntax and semantics of generic algorithms, but also places requirements on their performance. These performance requirements often correspond to a well-known algorithm, which is expected but not required to be used. In most cases this requires linear time O( n ) or linearithmic time O( n log n ), but in some cases higher bounds are allowed, such as quasilinear time O( n log n ) for stable sort (to allow in-place merge sort ). Previously, sorting

1575-435: Is also a left parenthesis that begins the argument list of the macro invocation. The exact procedure followed for expansion of function-like macros with arguments is subtle. Object-like macros were conventionally used as part of good programming practice to create symbolic names for constants; for example: instead of hard-coding numbers throughout the code. An alternative in both C and C++, especially in situations in which

SECTION 20

#1732781099866

1650-417: Is also commonly known as a has-a relationship. For example, a class "Car" could be composed of and contain a class "Engine". Therefore, a Car has an Engine. One aspect of composition is containment, which is the enclosure of component instances by the instance that has them. If an enclosing object contains component instances by value, the components and their enclosing object have a similar lifetime . If

1725-545: Is called a pure abstract base class (or pure ABC ) in C++ and is also known as an interface by users of the language. Other languages, notably Java and C#, support a variant of abstract classes called an interface via a keyword in the language. In these languages, multiple inheritance is not allowed, but a class can implement multiple interfaces. Such a class can only contain abstract publicly accessible methods. In some languages, classes can be declared in scopes other than

1800-520: Is described by official standards for these languages, such as the ISO C standard. Implementations may provide their own extensions and deviations, and vary in their degree of compliance with written standards. Their exact behavior may depend on command-line flags supplied on invocation. For instance, the GNU C preprocessor can be made more standards compliant by supplying certain flags. The #pragma directive

1875-405: Is given end of an association and describes the role of the corresponding class. For example, a "subscriber" role describes the way instances of the class "Person" participate in a "subscribes-to" association with the class "Magazine". Also, a "Magazine" has the "subscribed magazine" role in the same association. Association role multiplicity describes how many instances correspond to each instance of

1950-642: Is initialized using an #embed directive, the result is the same as-if the resource was written to the array using fread (unless a parameter changes the embed element width to something other than CHAR_BIT ). Apart from the convenience, #embed is also easier for compilers to handle, since they are allowed to skip expanding the directive to its full form due to the as-if rule . The file to be embedded can be specified in an identical fashion to #include , meaning, either between chevrons or between quotes. The directive also allows certain parameters to be passed to it to customise its behaviour, which follow

2025-411: Is not an intrinsic aspect of classes. An object-based language (i.e. Classic Visual Basic ) supports classes yet does not support inheritance. A programming language may support various class relationship features. Classes can be composed of other classes, thereby establishing a compositional relationship between the enclosing class and its embedded classes. Compositional relationship between classes

2100-455: Is not empty. Finally, the if_empty parameter replaces the entire directive if the resource is empty (which happens if the file is empty or a limit of 0 is specified). All standard parameters can also be surrounded by double underscores, just like standard attributes on C23, for example __prefix__ is interchangeable with prefix . Implementation-defined parameters use a form similar to attribute syntax (e.g., vendor::attr ) but without

2175-408: Is present, the macro will be interpreted as object-like with everything starting from the first parenthesis added to the token list. A macro definition can be removed with #undef : Whenever the identifier appears in the source code it is replaced with the replacement token list, which can be empty. For an identifier declared to be a function-like macro, it is only replaced when the following token

2250-533: Is then referenced repeatedly. Many compilers define additional, non-standard macros, although these are often poorly documented. A common reference for these macros is the Pre-defined C/C++ Compiler Macros project , which lists "various pre-defined compiler macros that can be used to identify standards, compilers, operating systems, hardware architectures, and even basic run-time libraries at compile-time." The # operator (known as

2325-440: The #error directive: There are two types of macros: object-like and function-like . Object-like macros do not take parameters; function-like macros do (although the list of parameters may be empty). The generic syntax for declaring an identifier as a macro of each type is, respectively: The function-like macro declaration must not have any whitespace between the identifier and the first, opening parenthesis. If whitespace

C++ Standard Library - Misplaced Pages Continue

2400-448: The _WIN32 macro, it can be specified on the compiler's command line, using -D_WIN32 . The example code tests if a macro __unix__ is defined. If it is, the file <unistd.h> is then included. Otherwise, it tests if a macro _WIN32 is defined instead. If it is, the file <windows.h> is then included. A more complex #if example can use operators; for example: Translation can also be caused to fail by using

2475-416: The square root of a number. The C++ Standard Library also incorporates most headers of the ISO C standard library ending with ".h", but their use was deprecated (reverted the deprecation since C++23 ). C++23 instead considers these headers as useful for interoperability with C , and recommends against their usage outside of programs that are intended to be both valid C and C++ programs. No other headers in

2550-437: The stringification operator or stringizing operator ) converts a token into a C string literal , escaping any quotes or backslashes appropriately. Example: If stringification of the expansion of a macro argument is desired, two levels of macros must be used: A macro argument cannot be combined with additional text and then stringified. However, a series of adjacent string constants and stringified arguments can be written:

2625-456: The .h, and adding a 'c' at the start; for example, 'time.h' becomes 'ctime'. The only difference between these headers and the traditional C Standard Library headers is that where possible the functions should be placed into the std:: namespace. In ISO C, functions in the standard library are allowed to be implemented by macros , which is not allowed by ISO C++. Class (computer science) Object state can differ between each instance of

2700-411: The C compiler will then combine all the adjacent string constants into one long string. The ## operator (known as the "Token Pasting Operator") concatenates two tokens into one token. Example: The #error directive outputs a message through the error stream. C23 will introduce the #embed directive for binary resource inclusion. This allows binary files (like images) to be included into

2775-557: The C++ ISO Standardization effort in the 1990s. Since 2011, it has been expanded and updated every three years with each revision of the C++ standard. The Apache C++ Standard Library is another open-source implementation. It was originally developed commercially by Rogue Wave Software and later donated to the Apache Software Foundation . However, after more than five years without a release,

2850-557: The C++ Standard Library end in ".h". Features of the C++ Standard Library are declared within the std namespace . The C++ Standard Library is based upon conventions introduced by the Standard Template Library (STL), and has been influenced by research in generic programming and developers of the STL such as Alexander Stepanov and Meng Lee. Although the C++ Standard Library and the STL share many features, neither

2925-601: The Internet requires this level of flexibility and the technology standards such as the Web Ontology Language (OWL) are designed to support it. A similar issue is whether or not the class hierarchy can be modified at run time. Languages such as Flavors, CLOS, and Smalltalk all support this feature as part of their meta-object protocols . Since classes are themselves first-class objects, it is possible to have them dynamically alter their structure by sending them

3000-507: The appropriate messages. Other languages that focus more on strong typing such as Java and C++ do not allow the class hierarchy to be modified at run time. Semantic web objects have the capability for run time changes to classes. The rationale is similar to the justification for allowing multiple superclasses, that the Internet is so dynamic and flexible that dynamic changes to the hierarchy are required to manage this volatility. Although many class-based languages support inheritance, inheritance

3075-615: The board of the Apache Software Foundation decided to end this project and move it to Apache Attic. The following libraries implement much of the C++ Standard Library: Ever since the modules were introduced in C++20 , there has been no support for standard library modules until C++23 . These named modules were added to include all items declared in both global and std namespaces provided by

C++ Standard Library - Misplaced Pages Continue

3150-410: The class from outside the enclosing class. A related concept is inner types , also known as inner data type or nested type , which is a generalization of the concept of inner classes. C++ is an example of a language that supports both inner classes and inner types (via typedef declarations). A local class is a class defined within a procedure or function. Such structure limits references to

3225-431: The class name to within the scope where the class is declared. Depending on the semantic rules of the language, there may be additional restrictions on local classes compared to non-local ones. One common restriction is to disallow local class methods to access local variables of the enclosing function. For example, in C++, a local class may refer to static variables declared within its enclosing function, but may not access

3300-465: The class or specific instances of the class. In most languages, the structure defined by the class determines the layout of the memory used by its instances. Other implementations are possible: for example, objects in Python use associative key-value containers. Some programming languages such as Eiffel support specification of invariants as part of the definition of the class, and enforce them through

3375-426: The class whereas the class state is shared by all of them. The object methods include access to the object state (via an implicit or explicit parameter that references the object) whereas class methods do not. If the language supports inheritance , a class can be defined based on another class with all of its state and behavior plus additional state and behavior that further specializes the class. The specialized class

3450-597: The classes that they are derived from. For example, if "class A" inherits from "class B" and if "class B" implements the interface "interface B" then "class A" also inherits the functionality(constants and methods declaration) provided by "interface B". In languages that support access specifiers , the interface of a class is considered to be the set of public members of the class, including both methods and attributes (via implicit getter and setter methods ); any private members or internal data structures are not intended to be depended on by external code and thus are not part of

3525-502: The components are contained by reference, they may not have a similar lifetime. For example, in Objective-C 2.0: This Car class has an instance of NSString (a string object), Engine , and NSArray (an array object). Classes can be derived from one or more existing classes, thereby establishing a hierarchical relationship between the derived-from classes ( base classes , parent classes or superclasses ) and

3600-474: The derivation chain. Most object-oriented programming languages allow the programmer to specify which classes are considered abstract and will not allow these to be instantiated. For example, in Java , C# and PHP , the keyword abstract is used. In C++ , an abstract class is a class having at least one abstract method given by the appropriate syntax in that language (a pure virtual function in C++ parlance). A class consisting of only pure virtual methods

3675-624: The derived class ( child class or subclass ) . The relationship of the derived class to the derived-from classes is commonly known as an is-a relationship. For example, a class 'Button' could be derived from a class 'Control'. Therefore, a Button is a Control. Structural and behavioral members of the parent classes are inherited by the child class. Derived classes can define additional structural members (data fields) and behavioral members (methods) in addition to those that they inherit and are therefore specializations of their superclasses. Also, derived classes can override inherited methods if

3750-412: The division. Function-like macro expansion occurs in the following stages: This may produce surprising results: Certain symbols are required to be defined by an implementation during preprocessing. These include __FILE__ and __LINE__ , predefined by the preprocessor itself, which expand into the current file and line number. For instance, the following: prints the value of x , preceded by

3825-449: The file 'stdio.h', which declares the printf() function among other things. This can also be written using double quotes, e.g. #include "stdio.h" . If the filename is enclosed within angle brackets, the file is searched for in the standard compiler include paths. If the filename is enclosed within double quotes, the search path is expanded to include the current source file directory. C compilers and programming environments all have

SECTION 50

#1732781099866

3900-516: The file and line number to the error stream, allowing quick access to which line the message was produced on. Note that the WHERESTR argument is concatenated with the string following it. The values of __FILE__ and __LINE__ can be manipulated with the #line directive. The #line directive determines the line number and the file name of the line below. For example: generates the printf function: Source code debuggers refer also to

3975-414: The file name. The C standard defines the following parameters and implementations may define their own. The limit parameter is used to limit the width of the included data. It is mostly intended to be used with "infinite" files like urandom . The prefix and suffix parameters allow the programmer to specify a prefix and suffix to the embedded data, which is used if and only if the embedded resource

4050-431: The full description of a television, including its attributes (structure) and buttons (interface). Getting the total number of televisions manufactured could be a static method of the television class. This method is associated with the class, yet is outside the domain of each instance of the class. A static method that finds a particular instance out of the set of all television objects is another example. The following

4125-456: The function's automatic variables . A metaclass is a class where instances are classes. A metaclass describes a common structure of a collection of classes and can implement a design pattern or describe particular kinds of classes. Metaclasses are often used to describe frameworks . C preprocessor The C preprocessor is the macro preprocessor for several computer programming languages , such as C , Objective-C , C++ , and

4200-446: The global scope. There are various types of such classes. An inner class is a class defined within another class. The relationship between an inner class and its containing class can also be treated as another type of class association. An inner class is typically neither associated with instances of the enclosing class nor instantiated along with its enclosing class. Depending on the language, it may or may not be possible to refer to

4275-431: The importable standard headers. Macros are not allowed to be exportable, so users have to manually include or import headers that emit macros for use. The following files contain the declarations of the C++ Standard Library. Components that C++ programs may use to perform seminumerical operations. Each header from the C Standard Library is included in the C++ Standard Library under a different name, generated by removing

4350-432: The interface. Object-oriented programming methodology dictates that the operations of any interface of a class are to be independent of each other. It results in a layered design where clients of an interface use the methods declared in the interface. An interface places no requirements for clients to invoke the operations of one interface in any particular order. This approach has the benefit that client code can assume that

4425-623: The language allows. Not all languages support multiple inheritance. For example, Java allows a class to implement multiple interfaces, but only inherit from one class. If multiple inheritance is allowed, the hierarchy is a directed acyclic graph (or DAG for short), otherwise it is a tree . The hierarchy has classes as nodes and inheritance relationships as links. Classes in the same level are more likely to be associated than classes in different levels. The levels of this hierarchy are called layers or levels of abstraction. Example (Simplified Objective-C 2.0 code, from iPhone SDK): In this example,

4500-558: The name of the function definition within which it is contained, but because the preprocessor is agnostic to the grammar of C, this must be done in the compiler itself using a variable local to the function. Macros that can take a varying number of arguments ( variadic macros ) are not allowed in C89, but were introduced by a number of compilers and standardized in C99 . Variadic macros are particularly useful when writing wrappers to functions taking

4575-667: The object-oriented community consider antithetical to the goals of using object classes in the first place. Understanding which class will be responsible for handling a message can get complex when dealing with more than one superclass. If used carelessly this feature can introduce some of the same system complexity and ambiguity classes were designed to avoid. Most modern object-oriented languages such as Smalltalk and Java require single inheritance at run time. For these languages, multiple inheritance may be useful for modeling but not for an implementation. However, semantic web application objects do have multiple superclasses. The volatility of

SECTION 60

#1732781099866

4650-473: The objects, such as error checking on get and set methods . One important question when modeling and implementing a system of object classes is whether a class can have one or more superclasses. In the real world with actual sets, it would be rare to find sets that did not intersect with more than one other set. However, while some systems such as Flavors and CLOS provide a capability for more than one parent to do so at run time introduces complexity that many in

4725-405: The operations of an interface are available for use whenever the client has access to the object. The buttons on the front of your television set are the interface between you and the electrical wiring on the other side of its plastic casing. You press the "power" button to toggle the television on and off. In this example, your particular television is the instance, each method is represented by

4800-507: The other class of the association. Common multiplicities are "0..1", "1..1", "1..*" and "0..*", where the "*" specifies any number of instances. There are many categories of classes, some of which overlap. In a language that supports inheritance, an abstract class , or abstract base class ( ABC ), is a class that cannot be directly instantiated. By contrast, a concrete class is a class that can be directly instantiated. Instantiation of an abstract class can occur only indirectly, via

4875-553: The possibility of incorrect order of operations when it is an expression instead of a single value. For example, the expression RADTODEG ( r + 1 ) expands correctly as (( r + 1 ) * 57.29578 ) ; without parentheses, ( r + 1 * 57.29578 ) gives precedence to the multiplication. Similarly, the outer pair of parentheses maintain correct order of operation. For example, 1 / RADTODEG ( r ) expands to 1 / (( r ) * 57.29578 ) ; without parentheses, 1 / ( r ) * 57.29578 gives precedence to

4950-415: The private data of a class to compile. In the C++ language, private methods are visible, but not accessible in the interface; however, they may be made invisible by explicitly declaring fully abstract classes that represent the interfaces of the class. Some languages feature other accessibility schemes: Conceptually, a superclass is a superset of its subclasses. For example, GraphicObject could be

5025-398: The program without them being valid C source files (like XBM), without requiring processing by external tools like xxd -i and without the use of string literals which have a length limit on MSVC . Similarly to xxd -i the directive is replaced by a comma separated list of integers corresponding to the data of the specified resource. More precisely, if an array of type unsigned char

5100-766: The programmer to define and call these special methods. Every class implements (or realizes ) an interface by providing structure and behavior. Structure consists of data and state, and behavior consists of code that specifies how methods are implemented. There is a distinction between the definition of an interface and the implementation of that interface; however, this line is blurred in many programming languages because class declarations both define and implement an interface. Some languages, however, provide features that separate interface and implementation. For example, an abstract class can define an interface without providing an implementation. Languages that support class inheritance also allow classes to inherit interfaces from

5175-465: The source position defined with __FILE__ and __LINE__ . This allows source code debugging when C is used as the target language of a compiler, for a totally different language. The first C Standard specified that the macro __STDC__ be defined to 1 if the implementation conforms to the ISO Standard and 0 otherwise, and the macro __STDC_VERSION__ defined as a numeric literal specifying

5250-441: The square brackets. While all standard parameters require an argument to be passed to them (e.g., limit requires a width), this is generally optional and even the set of parentheses can be omitted if an argument is not required, which might be the case for some implementation-defined parameters. All C, C++, and Objective-C implementations provide a preprocessor, as preprocessing is a required step for those languages, and its behavior

5325-653: The type system. Encapsulation of state is necessary for being able to enforce the invariants of the class. The behavior of a class or its instances is defined using methods . Methods are subroutines with the ability to operate on objects or classes. These operations may alter the state of an object or simply provide ways of accessing it. Many kinds of methods exist, but support for them varies across languages. Some types of methods are created and called by programmer code, while other special methods—such as constructors, destructors, and conversion operators—are created and called by compiler-generated code. A language may also allow

5400-450: The usefulness of the file inclusion mechanisms available in BCPL and PL/I . Its original version offered only file inclusion and simple string replacement using #include and #define for parameterless macros, respectively. It was extended shortly after, firstly by Mike Lesk and then by John Reiser, to incorporate macros with arguments and conditional compilation. The C preprocessor

5475-482: The version of the Standard supported by the implementation. Standard C++ compilers support the __cplusplus macro. Compilers running in non-standard mode must not set these macros or must define others to signal the differences. Other Standard macros include __DATE__ , the current date, and __TIME__ , the current time. The second edition of the C Standard, C99 , added support for __func__ , which contains

5550-577: Was only required to take O( n log n ) on average, allowing the use of quicksort , which is fast in practice but has poor worst-case performance, but introsort was introduced to allow both fast average performance and optimal worst-case complexity, and as of C++11 , sorting is guaranteed to be at worst linearithmic. In other cases requirements remain laxer, such as selection , which is only required to be linear on average (as in quickselect ), not requiring worst-case linear as in introselect . The C++ Standard Library underwent ISO standardization as part of

5625-415: Was part of a long macro-language tradition at Bell Labs, which was started by Douglas Eastwood and Douglas McIlroy in 1959. Preprocessing is defined by the first four (of eight) phases of translation specified in the C Standard. One of the most common uses of the preprocessor is to include another source file: The preprocessor replaces the line #include <stdio.h> with the textual content of

#865134