Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Function objects


Related Topics

  
  Function Objects
In this example, the function object is an object of a user-defined class.
In this example, the function object is of a user-defined class that has local state.
[1] The reason for the name "adaptable function object" is that adaptable function objects may be used by function object adaptors.
www.sgi.com /tech/stl/functors.html   (553 words)

  
 Javascript Closures   (Site not responding. Last check: 2007-10-20)
function and passes a reference to a function object as the first argument and the millisecond interval as the second, but a reference to a function object cannot provide parameters for the scheduled execution of that function.
Suppose a function is to build a string and to avoid the repeated concatenation operations (and the creation of numerous intermediate strings) the desire is to use an array to store the parts of the string in sequence and then output the results using the Array.prototype.join method (with an empty string as its argument).
As the inner function in the first version is not being used to exploit the closures produced by its use, it would be more efficient not to use an inner function, and thus not repeat the process of creating many essentially identical function objects.
jibbering.com /faq/faq_notes/closures.html   (6630 words)

  
 Programming : STL : Function objects
Function objects are like ordinary C++ functions, however they (can) have a "state", so that they can remember things (eg.
A function object is a normal C++ class, however inside it implements the "operator ()" - this operator is called whenever the function is to be called by another function.
If you give a function object as the function to be called the function object can use its operator() for each call.
www.gammon.com.au /forum/bbshowpost.php?bbsubject_id=4181   (486 words)

  
 C++ Development Environment - function_objects_3c__std   (Site not responding. Last check: 2007-10-20)
Function objects are used in place of pointers to functions as arguments to templated algorithms.
Similarly, function objects that take two arguments are called binary function objects and, as such, are required to provide the typedefs first_argument_type, second_argument_type, and result_type.
The necessary typedefs for a unary or binary function object are provided by inheriting from the appropriate function object class.
h30097.www3.hp.com /cplus/function_objects_3c__std.htm   (310 words)

  
 A Proposal to add a Polymorphic Function Object Wrapper to the Standard Library
Function pointers in C and C++ are used in both user and library code to customize the behavior of components by substituting a user-supplied function for part of a computation.
Several function object wrappers (often referred to as "callbacks") have appeared with similar interfaces [1, 2, 10, 11], suggesting that this class template is appropriate for standardization.
Polymorphic function object wrappers may also be used in lieu of arbitrary function objects whose type is a template parameter, allowing a trivial switch from function templates to functions (with a corresponding size/speed tradeoff).
www.open-std.org /jtc1/sc22/wg21/docs/papers/2002/n1402.html   (2122 words)

  
 Function Objects   (Site not responding. Last check: 2007-10-20)
When a function object is used as a function, the function call operator is invoked whenever the function is called.
The importance of inheritance from one of the two base class templates becomes apparent when elementary function objects are composed to form complex expressions using negators and binders, which are explained in Section 3.5.
A more complex example of using a function object occurs in the radix sorting example program, which is given as an example of using the list datatype in Section 6.3.
www.roguewave.com /support/docs/sourcepro/stdlibug/3-2.html   (857 words)

  
 CH10.html
Object is always the parent Object Netscape allows you to omit it from your expressions that involve other Objects since it is always assumed to be there.
Function from before in the HEAD of the document, it is then executed in the BODY of the document in a separate Script by calling it by name.
Functions make use of references to JavaScript Objects that are created by the JavaScript interpreter after the HTML that creates those Elements in the BODY of the document is loaded, the Script is contained after that relevant HTML in the BODY.
home.nycap.rr.com /sentinelsoflight/learning/CH10.html   (6453 words)

  
 Introduction and Features of JavaScript "Function" Objects
When we declare function like this, the content of the function is compiled (but not executed until we call the function).
We can reassign function after you created it, but we need to refer to the function object itself, not a pointer to it.
This is because when an object is created, the constructor function assigns its prototype property to the internal __proto__ property of the new object.
www.permadi.com /tutorial/jsFunc   (2910 words)

  
 Function Objects   (Site not responding. Last check: 2007-10-20)
Useful to have function objects to further leverage STL library
Numerical functions have built-in meaning using + or *, as well as user-provided binary operators which could be passed in
Function objects are classes that have operator() defined
www.cse.ucsc.edu /~pohl/Winter01/STL/sld087.htm   (48 words)

  
 Stroustrup: C++ Style and Technique FAQ
Having virtual functions indicate that a class is meant to act as an interface to derived classes, and when it is, an object of a derived class may be destroyed through a pointer to the base.
In C++, virtual function calls are so fast that their real-world use for a class designed with virtual functions does not to produce measurable run-time overheads compared to alternative solutions using ordinary function calls.
A function object is a more general concept than a function because a function object can have state that persist across several calls (like a static local variable) and can be initialized and examined from outside the object (unlike a static local variable).
www.research.att.com /~bs/bs_faq2.html   (10948 words)

  
 Chapter 4. Boost.Function   (Site not responding. Last check: 2007-10-20)
It shares features with function pointers in that both define a call interface (e.g., a function taking two integer arguments and returning a floating-point value) through which some implementation can be called, and the implementation that is invoked may change throughout the course of the program.
Generally, any place in which a function pointer would be used to defer a call or make a callback, Boost.Function can be used instead to allow the user greater flexibility in the implementation of the target.
Targets can be any 'compatible' function object (or function pointer), meaning that the arguments to the interface designated by Boost.Function can be converted to the arguments of the target function object.
www.boost.org /doc/html/function.html   (156 words)

  
 Boost Libraries
function - Function object wrappers for deferred calls or callbacks, from Doug Gregor.
functional - Enhanced function object adaptors, from Mark Rodgers.
compose - Functional composition adapters for the STL, from Nicolai Josuttis.
www.boost.org /libs/libraries.htm   (2247 words)

  
 Predicates vs. Function Objects - C++ Report - ADTmag.com   (Site not responding. Last check: 2007-10-20)
A function object that returns a Boolean value is a predicate.
What follows from this is that whenever you pass a function object as a predicate to an STL algorithm, the function object should guarantee that it always returns the same result when invoked with the same arguments.
That is, the function object should not change its state due to the call.
www.adtmag.com /joop/crarticle.asp?ID=770   (891 words)

  
 Bruce Eckel's MindView, Inc: 10-22-04 Using Function Objects as Strategies   (Site not responding. Last check: 2007-10-20)
As I've found with a number of design patterns, the lines get kind of blurry here: we are creating function objects which perform adaptation and they are being passed into methods to be used as strategies.
The function // object may act as a collecting parameter, so it is // returned at the end.
There are other types of function objects that can be defined but these are enough to make the point.
mindview.net /WebLog/log-0064   (642 words)

  
 XEmacs Lisp Reference Manual - Compiled-Function Objects
Byte-compiled functions have a special data type: they are compiled-function objects.
A compiled-function object is a bit like a vector; however, the evaluator handles this data type specially when it appears as a function to be called.
You should not try to come up with the elements for a compiled-function object yourself, because if they are inconsistent, XEmacs may crash when you call the function.
www.tau.ac.il /cc/pages/docs/xemacs/lispref_218.html   (457 words)

  
 R Language Definition
When programming in the R language the type of an object generally doesn't affect the computations, however, when dealing with foreign languages or the operating system it is often necessary to ensure that an object is of the correct type.
When a function is being evaluated the actual expression used as an argument is stored in the promise together with a pointer to the environment the function was called from.
When a function is called, each formal argument is assigned a promise in the local environment of the call with the expression slot containing the actual argument and the environment slot containing the environment of the parent.
www.ualberta.ca /CNS/RESEARCH/Rdoc/R/doc/manual/R-lang.html   (13817 words)

  
 code & function objects   (Site not responding. Last check: 2007-10-20)
I had no idea that code objects could be real useful for mere mortals before Lance posted his example.
The output I find most readable is the kind that constructs a sequence of Icon expressions that would, if executed, reproduce the original structure (up to pointer isomorphism).
Seems this differs from the obvious technique of writing out the "reproduce the object" code as a string, and exec'ing that string later, in putting the compilation expense on the "write" end instead of the "read" end.
www.python.org /tim_one/000103.html   (270 words)

  
 Function Objects
They are important for the effective use of the standard library's generic algorithms, because the interface for each algorithmic template can accept either an object with an
Unary function objects are required to provide the typedefs
Similarly, function objects that take two arguments are called binary function objects and, as such, are required to provide the typedefs
www.roguewave.com /support/docs/hppdocs/stdref/functionobjects.html   (206 words)

  
 6: Function objects
However, the theme of the function object is repeated in a number of patterns in that book.
The “thing that stays the same” is the body of the method that’s being called, and the part that varies is isolated in the function object.
The termination condition is either the bottom of the chain is reached (in which case a default object is returned; you may or may not be able to provide a default result so you must be able to determine the success or failure of the chain) or one of the Strategies is successful.
jamesthornton.com /eckel/TIPython/html/Sect09.htm   (1176 words)

  
 6: Function objects
The point is to decouple the choice of function to be called from the site where that function is called.
By wrapping a method in an object, you can pass it to other methods or objects as a parameter, to tell them to perform this particular operation in the process of fulfilling your request.
On the other hand, with a Command object you typically just create it and hand it to some method or object, and are not otherwise connected over time to the Command object.
www.gae.ucm.es /~fonta/ThinkingInPattersWithJava/Chapter06.html   (894 words)

  
 STL Overview: Function Objects
Function objects take the place of function pointers in traditional C programming.
Function adaptors take function objects and mutate their application.
See also [Laufer95] for an interesting treatment of function binding and composition.
pages.cpsc.ucalgary.ca /~kremer/STL/800x600/functobj.html   (136 words)

  
 Using Function Objects as Strategies   (Site not responding. Last check: 2007-10-20)
Surround code listings with
 and 
, and if you use < and > symbols you must say & lt ; and & gt ;
I particularly like the term function object that you use, I find it more descriptive than closure, first-class function, functor, etc., hopefully it will catch on!
As an aside from my main post: this blog is almost like a religuous conversion, suddenly you are writting using patterns like adaptor and strategy :)
www.mindview.net /WebLog/wiki-0064   (644 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.