Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Standard Template Library
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Functions === The STL includes classes that [[Function overloading|overload]] the function call operator ({{Cpp|operator()}}). Instances of such classes are called functors or [[function objects]]. Functors allow the behavior of the associated function to be parameterized (e.g. through arguments passed to the functor's [[Constructor (object-oriented programming)|constructor]]) and can be used to keep associated per-functor state information along with the function. Since both functors and function pointers can be invoked using the syntax of a function call, they are interchangeable as arguments to templates when the corresponding parameter only appears in function call contexts. A particularly common type of functor is the [[Predicate (computer programming)|predicate]]. For example, algorithms like {{Cpp|find_if}} take a [[unary function|unary]] predicate that operates on the elements of a sequence. Algorithms like sort, partial_sort, nth_element and all sorted [[Container (data structure)|containers]] use a [[binary function|binary]] predicate that must provide a [[strict weak ordering]], that is, it must behave like a [[set membership|membership]] test on a transitive, non-reflexive and asymmetric [[binary relation]]. If none is supplied, these algorithms and containers use [http://www.sgi.com/tech/stl/less.html less] by default, which in turn calls the less-than-operator <.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Standard Template Library
(section)
Add topic