Boost logo

Boost :

From: Daron Anderson (dnanderson_at_[hidden])
Date: 2003-09-15 01:02:12


>Does anyone know how to wrap a function taking a pointer to
>pointer to a type? (or where to look in the documentation)

When you say 'wrap', are you talking about using the Boost.Function library
as a wrapping mechanism for a free function? If so, a basic tutorial is
available at

http://www.boost.org/doc/html/function.tutorial.html

This tutorial does not explicitly point out any difference between
references, object names, pointers, pointers to pointers, etc., since they
are equally usable through the template parameters. For example the
following code compiles properly on a MSVC++ 6.0 compiler. See the tutorial
for a list of 'preferred' syntax, if you have a more standards-compliant
compiler.

/////////////////////////////////////////////////////////
//
#include <boost\function\function1.hpp>

// this is the function to be wrapped
void raw_function( int** ppi )
{
 // do something with ppi
}

void fn()
{
 // this is the wrapper for the function
 boost::function1< void, int** > fn1;

 // assign the function to the wrapper
 fn1 = &raw_function;

 // create a pointer to pointer and call the function
 int* ppi;
 fn1( &ppi );
}

Is this example sufficient,or have I misunderstood what you are looking for?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk