From eb234b3e667087763135ca741d5dda7f1ac7da67 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 10 Oct 2002 05:12:07 +0000 Subject: [PATCH] Tidy up the HTML [SVN r15838] --- doc/faq.html | 4 ++-- doc/reference.html | 13 +++++-------- doc/tutorial.html | 23 +++++++++++------------ index.html | 4 ++-- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/doc/faq.html b/doc/faq.html index 5b1e07e..7bdd3b4 100644 --- a/doc/faq.html +++ b/doc/faq.html @@ -5,7 +5,7 @@ -

boost::function Frequently Asked Questions

+

C++ Boostboost::function Frequently Asked Questions

Q: I see void pointers; is this [mess] type safe?

Yes, boost::function is type safe even though it uses void pointers and pointers to functions returning void and taking no arguments. Essentially, all type information is encoded in the functions that manage and invoke function pointers and function objects. Only these functions are instantiated with the exact type that is pointed to by the void pointer or pointer to void function. The reason that both are required is that one may cast between void pointers and object pointers safely or between different types of function pointers (provided you don't invoke a function pointer with the wrong type). @@ -21,7 +21,7 @@ void g() { return f(); }

 int do_something(int);
 
-boost::function f;
+boost::function<void, int> f;
 f = do_something;
 

This is a valid usage of boost::function because void returns are not used. With void returns, we would attempting to compile ill-formed code similar to: diff --git a/doc/reference.html b/doc/reference.html index 51d73e6..911dbdc 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -6,9 +6,9 @@ -

Boost.Function Reference Manual

+

C++ BoostBoost.Function Reference Manual

-

Header <boost/function.hpp> synopsis

+

Header <boost/function.hpp> synopsis

Here MAX_ARGS is an implementation-defined constant that defines the maximum number of function arguments supported by Boost.Function and will be at least 10. The MAX_ARGS constant referred to in this document need not have any direct representation in the library.

@@ -84,7 +84,7 @@
             functionN<ResultType, Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&);
 
   // For any N in [0, MAX_ARGS]
-  template<typename Signature, // Function type: ResultType (Arg1, Arg2, ..., ArgN)
+  template<typename Signature, // Function type: ResultType (Arg1, Arg2, ..., ArgN)
 	   typename Policy    = empty_function_policy, // Deprecated
 	   typename Mixin     = empty_function_mixin, // Deprecated
 	   typename Allocator = std::allocator<function_base> >
@@ -112,7 +112,6 @@
 

Definitions

-

-

template<typename F> functionN(reference_wrapper<F> g); +

template<typename F> functionN(reference_wrapper<F> g);

-

template<typename F> functionN& operator=(reference_wrapper<F> g); +

template<typename F> functionN& operator=(reference_wrapper<F> g);

-

 template<typename Signature, typename Policy, typename Mixin, typename Allocator>
 void swap(function<Signature, Policy, Mixin, Allocator>& f,
diff --git a/doc/tutorial.html b/doc/tutorial.html
index e875058..79d6089 100644
--- a/doc/tutorial.html
+++ b/doc/tutorial.html
@@ -6,17 +6,17 @@
 
   
 
-    

Boost.Function Tutorial

+

C++ BoostBoost.Function Tutorial

Boost.Function has two syntactical forms: the preferred form and the compatibility form. The preferred form fits more closely with the C++ language and reduces the number of separate template parameters that need to be considered, often improving readability; however, the preferred form is not supported on all platforms due to compiler bugs. The compatible form will work on all compilers supported by Boost.Function. Consult the table below to determine which syntactic form to use for your compiler.

- +
Preferred SyntaxCompatible Syntax
    -
  • GNU C++ 2.95.x, 3.0.x, 3.1.x
  • +
  • GNU C++ 2.95.x, 3.0.x, 3.1.x, 3.2
  • Comeau C++ 4.2.45.2
  • SGI MIPSpro 7.3.0
  • Intel C++ 5.0, 6.0
  • @@ -37,10 +37,10 @@

    If your compiler does not appear in this list, please try the preferred syntax and report your results to the Boost list so that we can keep this table up-to-date. -

    Basic Usage

    +

    Basic Usage

    A function wrapper is defined simply by instantiating the function class template with the desired return type and argument types, formulated as a C++ function type. Any number of arguments may be supplied, up to some implementation-defined limit (10 is the default maximum). The following declares a function object wrapper f that takes two int parameters and returns a float:

    - +
    Preferred SyntaxCompatible Syntax
    @@ -77,7 +77,7 @@ std::cout << f(5, 3) >> std::endl;

    We are free to assign any compatible function object to f. If int_div had been declared to take two long operands, the implicit conversions would have been applied to the arguments without any user interference. The only limit on the types of arguments is that they be CopyConstructible, so we can even use references and arrays:

    - +
    Preferred SyntaxCompatible Syntax
    @@ -95,7 +95,7 @@ boost::function4<void, int[], int, int&, float> sum_avg;
    -void do_sum_avg(int values[], int n, int& sum, float& avg)
    +void do_sum_avg(int values[], int n, int& sum, float& avg)
     {
       sum = 0;
       for (int i = 0; i < n; i++)
    @@ -125,13 +125,12 @@ else
     
     

    Note that the & isn't really necessary unless you happen to be using Microsoft Visual C++ version 6. -

    Member functions

    - +

    Member functions

    In many systems, callbacks often call to member functions of a particular object. This is often referred to as "argument binding", and is beyond the scope of Boost.Function. The use of member functions directly, however, is supported, so the following code is valid:

    - +
    Preferred SyntaxCompatible Syntax
    @@ -172,7 +171,7 @@ f(&x, 5);
  • The C++ Standard library. Using std::bind1st and std::mem_fun together one can bind the object of a pointer-to-member function for use with Boost.Function:
    - +
    Preferred SyntaxCompatible Syntax
    @@ -216,7 +215,7 @@ href="../../bind/ref.html">ref and cref functions to wrap a reference to a function object:
    - +
    Preferred SyntaxCompatible Syntax
    diff --git a/index.html b/index.html index 1d298bc..dbcff74 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ -

    Header <boost/function.hpp>

    +

    C++ BoostHeader <boost/function.hpp>

    The header <boost/function.hpp> includes 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. @@ -24,7 +24,7 @@

  • Frequently Asked Questions
  • -

    Compatibility Note

    +

    Compatibility Note

    Boost.Function has been partially redesigned to minimize the interface and make it cleaner. Several seldom- or never-used features of the older Boost.Function have been deprecated and will be removed in the near future. Here is a list of features that have been deprecated, the likely impact of the deprecations, and how to adjust your code:

    • The boost::function class template syntax has