Abstract
A 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 function objects. The types and number of arguments in the functions to be bound can be practically arbitrary; argument list lengths up to few dozens of elements can be supported.
The unbound arguments are expressed as special placeholders in the argument list; they can appear for any argument position. Hence, binding sites preserve the resemblance to the function prototype of the underlying function, leading to simple and intuitive syntax.
Binding can be applied recursively. This results in a versatile function composition mechanism. The binding mechanism is efficient in the sense that it induces very little or no runtime cost.
This work has been supported by the Academy of Finland, grant 37178. The author is grateful to Harri Hakonen and Daveed Vandevoorde for their valuable comments on the manuscript of this paper.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Stepanov, A. A., Lee, M.: The Standard Template Library. Hewlett-Packard Laboratories Technical Report HPL-94-34(R.1) (1994) http://www.hpl.hp.com/techreports.
International Standard, Programming Languages — C++. ISO/IEC:14882 (1998).
The SGI Standard Template Library. Silicon Graphics Computer Systems Inc. http://www.sgi.com/Technology/STL.
Liskov, B., Curtis, D., Day, M., Ghemawat S., Gruber R., Johnson, P., Myers A. C.: Theta Reference Manual, Preliminary version. Programming Methodology Group Memo 88 1995, MIT Lab. for Computer Science http://www.pmg.lcs.mit.edu/Theta.html.
Agents, iterators and introspection. Interactive Software Engineering Inc. Technology paper http://www.eiffel.com.
Stroustrup, B.: The C++ Programming Language-Third Edition. Addison-Wesley, Reading, Massachusetts 1997.
Järvi J.: Tuples and multiple return values in C++. submitted for publication, see TUCS Technical Report 249 (1999) http://www.tucs.fi/publications.
Veldhuizen, T.: Using C++ Template Metaprograms. C++ Report 7 (1995) 36–43.
Järvi J.: Compile Time Recursive Objects in C++. Proceedings of the TOOLS 27 conference (Beijing Sept. 1998) 66–77. IEEE Computer Society Press.
Czarnecki, K.: Generative Programming: Principles and Techniques of Software Engineering Based on Automated Configuration and Fragment-Based Component Models. Ph.D. Thesis, Technische Universität Ilmenau, Germany 1998.
The GNU Compiler Collection. http://www.gnu.org/software/gcc/gcc.html.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Järvi, J. (2000). C++ Function Object Binders Made Easy. In: Czarnecki, K., Eisenecker, U.W. (eds) Generative and Component-Based Software Engineering. GCSE 1999. Lecture Notes in Computer Science, vol 1799. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-40048-6_13
Download citation
DOI: https://doi.org/10.1007/3-540-40048-6_13
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-41172-7
Online ISBN: 978-3-540-40048-6
eBook Packages: Springer Book Archive