Boost logo

Boost :

From: Hubert Holin (Hubert.Holin_at_[hidden])
Date: 2003-01-30 12:29:57


Somewhere in the E.U., le 30/01/2003

   Bonjour

In article <005b01c2c87b$f8d90520$1d00a8c0_at_pdimov2>,
 "Peter Dimov" <pdimov_at_[hidden]> wrote:

> From: "Hubert Holin" <Hubert.Holin_at_[hidden]>
> [...]
>
> > but if I have a templated functions instead
> >
> > template<typename T>
> > void ft(int)
> > {
> > }
> >
> > then the following invocation will not compile
> >
> > test->add(BOOST_TEST_CASE(::boost::bind(&ft<int>, 1)));
>
> This is a C++ problem. You may need to first create a function pointer:
>
> void (*pf) (int) = &ft<int>;

      OK, this works. I shudder to think of the reasons why...

> and then use bind(pf, 1). The other option is to turn ft into a function
> object.

      Sigh... I started the first thread while trying to use a templated
function object...

      I guess it would help if the syntax for all four possibilities
(normal function, templated function, normal function object templated
function object) made it into the Boost.Test documentation.

   At any rate thank you very much!

HH


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