ET++—an object oriented application framework in C++
OOPSLA '88 Conference proceedings on Object-oriented programming systems, languages and applications
The annotated C++ reference manual
The annotated C++ reference manual
Unidraw: a framework for building domain-specific graphical editors
ACM Transactions on Information Systems (TOIS)
Advanced C++ programming styles and idioms
Advanced C++ programming styles and idioms
Object-oriented programming with C++ and OSF/Motif
Object-oriented programming with C++ and OSF/Motif
Object-oriented modeling and design
Object-oriented modeling and design
Integrating the Scheme and C languages
LFP '92 Proceedings of the 1992 ACM conference on LISP and functional programming
Iterators: signs of weakness in object-oriented languages
ACM SIGPLAN OOPS Messenger
The Definition of Standard ML
C: A Reference Manual
A framework for programming denotational semantics in C++
ACM SIGPLAN Notices
Pizza into Java: translating theory into practice
Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
ICFP '00 Proceedings of the fifth ACM SIGPLAN international conference on Functional programming
Calculating in an object-oriented iterator-view-generator framework
OOPSLA '00 Addendum to the 2000 proceedings of the conference on Object-oriented programming, systems, languages, and applications (Addendum)
A toolkit for weaving aspect oriented UML designs
AOSD '02 Proceedings of the 1st international conference on Aspect-oriented software development
The Lambda library: unnamed functions in C++
Software—Practice & Experience
Callback Implementations in C++
TOOLS '97 Proceedings of the Tools-23: Technology of Object-Oriented Languages and Systems
Developing an object-oriented framework for content-based image retrieval
Software—Practice & Experience
Functional programming with the FC++ library
Journal of Functional Programming
The function concept in C++: an empirical study
Proceedings of the 2009 ACM SIGPLAN workshop on Generic programming
Java as a functional programming language
TYPES'02 Proceedings of the 2002 international conference on Types for proofs and programs
Simple algebraic data types for C
Software—Practice & Experience
Hi-index | 0.00 |
C and C++ allow passing functions as arguments to other functions in the form of function pointers. However, since function pointers can refer only to existing functions declared at global or file scope, these function arguments cannot capture local environments. This leads to the common misconception that C and C++ do not support function closures. In fact, function closures can be modeled directly in C++ by enclosing a function inside an object such that the local environment is captured by data members of the object. This idiom is described in advanced C++ texts and is used, for example, to implement callbacks. The purpose of this paper is twofold: First, we demonstrate how this idiom can be generalized to a type-safe framework of C++ class templates for higher-order functions that support composition and partial application. Second, we explore the expressiveness of the framework and compare it with that of existing functional programming languages. We illustrate by means of various examples that object-oriented and functional idioms can coexist productively and can be used to enhance the functionality of common classes, for example, of nonlinear collections such as trees. A C++ implementation of the framework is available on request.