c++boost.gif (8819 bytes)HomeLibrariesPeopleFAQMore

Boost.Function

Douglas Gregor

Permission to copy, use, sell and distribute this software is granted provided this copyright notice appears in all copies. Permission to modify the code and to distribute modified code is granted provided this copyright notice appears in all copies, and a notice that the code was modified is included with the copyright notice.

This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

Table of Contents

Introduction
History & Compatibility Notes
Tutorial
Basic Usage
Free functions
Member functions
References to Functions
Reference
Definitions
Header <boost/function.hpp>
Frequently Asked Questions
Miscellaneous Notes
Boost.Function vs. Function Pointers
Performance
Function object wrapper size
Copying efficiency
Invocation efficiency
Combatting virtual function "bloat"
Acknowledgements
Testsuite
Acceptance tests
Negative tests

Introduction

The Boost.Function library contains a family of class templates that are function object wrappers. The notion is similar to a generalized callback. 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.

Last revised: February 19, 2003 at 22:46:09 GMT