|
Boost : |
From: larsbj_at_[hidden]
Date: 2001-06-12 06:47:24
I am having some problems with boost::function, from the documentation
I suppose this should work:
#include <iostream>
// I have moved some include files slightly
#include "function.hpp"
void foo()
{
std::cout << "Hello!" << std::endl;
}
int main()
{
boost::function<void> f;
f = &foo;
f();
}
However with gcc 2.96 I get these errors:
g++ -W -Wall -O2 -o test testfunction.C
In file included from testfunction.C:15:
function.hpp: In method `boost::function<R, T1, T2, T3, T4, T5, T6, T7,
T8, T9>::function (Functor) [with Functor = void (*) (), R = void, T1 =
boost::detail::unusable, T2 = boost::detail::unusable, T3 =
boost::detail::unusable, T4 = boost::detail::unusable, T5 =
boost::detail::unusable, T6 = boost::detail::unusable, T7 =
boost::detail::unusable, T8 = boost::detail::unusable, T9 =
boost::detail::unusable]':
function.hpp:415: instantiated from here
function.hpp:410: call of overloaded `function0(void (*&) ())' is
ambiguous
function_template.hpp:1264: candidates are: boost::function0<void,
Policy, Mixin, Allocator>::function0 (const Functor &) [with Functor =
void (*) (), Policy = boost::empty_function_policy, Mixin =
boost::empty_function_mixin, Allocator =
allocator<boost::function_base>]
function_template.hpp:1305: boost::function0<void,
Policy, Mixin, Allocator>::function0 (OtherR (*) ()) [with OtherR =
void, Policy = boost::empty_function_policy, Mixin =
boost::empty_function_mixin, Allocator =
allocator<boost::function_base>]
function_template.hpp:1345: boost::function0<void,
Policy, Mixin, Allocator>::function0 (const boost::function0<void,
Policy, Mixin, Allocator> &) [with Policy =
boost::empty_function_policy, Mixin = boost::empty_function_mixin,
Allocator = allocator<boost::function_base>] <near match>
-- Lgb
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk