Abstract
Passing functions and function objects to general purpose routines is a powerful abstraction mechanism that should be taught in freshman computer science. In C++, a "function" can be defined directly by the user or by a library or can be defined indirectly via operator() as a member function of a class. It is not obvious how to treat these "functions" in a uniform manner. We will show how function templates in C++ provide an elegant and teachable mechanism for passing entities with functional behavior as arguments to other functions.
- 1 Barton, John. J. and Nackman, Lee R., Scientific alrl Engineering C++: An Introduction With Advanced Techniques and Examples,, Addison-Wesley, Reading, MA, 1994. Google Scholar
Digital Library
- 2 Ellis, Margaret A. and Stroustrup, Bjame, The Annotated C++ Reference Manual, ANSI Base Document, Addison-Wesley, Reading, MA, 1990. Google Scholar
Digital Library
- 3 Meyers, Scott, Effective C++: 50 Ways to Improve Your Programs and Designs, Addison-Wesley, Reading, /VIA, 1992. Google Scholar
Digital Library
- 4 Meyers, Scott, More Effective C++: 35 New Ways to Improve Your Programs and Designs, Addison-Wesley, Reading, MA, 1996. Google Scholar
Digital Library
- 5 Musser, David and Saini, Atul, STL Tutorial atzl Reference Guide: C++ Programming with the Standard Template Library, Addison-Wesley, Reading, MA, 1996. Google Scholar
Digital Library
- 6 Pattis, Richard, Teaching C++ as an Introductory Programming Language (an electronic newsletter), Vol 1::2, February 15, 1996. Contaet: [email protected],Google Scholar
- 7 Stroustrup, Bjarne, The C++ Programming Langttage, 2nd Edition, Addison-Wesley, Reading, MA, 1991. Google Scholar
Digital Library
- 8 Stroustrup, Bjarne, The Design and Evolution of C++, Addison-Wesley, Reading, MA, 1994. Google Scholar
Digital Library
Index Terms
Function objects, function templates, and passage by behavior in C++
Recommendations
Function objects, function templates, and passage by behavior in C++
SIGCSE '97: Proceedings of the twenty-eighth SIGCSE technical symposium on Computer science educationPassing functions and function objects to general purpose routines is a powerful abstraction mechanism that should be taught in freshman computer science. In C++, a "function" can be defined directly by the user or by a library or can be defined ...
RBF neural network based on q-Gaussian function in function approximation
To enhance the generalization performance of radial basis function (RBF) neural networks, an RBF neural network based on a q-Gaussian function is proposed. A q-Gaussian function is chosen as the radial basis function of the RBF neural network, and a ...
C++ Function Object Binders Made Easy
GCSE '99: Proceedings of the First International Symposium on Generative and Component-Based Software EngineeringA novel argument binding mechanism that can be used with STL algorithm invocations is proposed. Without using any adaptors, binding can be applied directly to pointers to nonmember functions, pointers to const and nonconst member functions and STL ...







Comments