Boost logo

Boost Users :

Subject: [Boost-users] [phoenix] Simple bind example not compiling
From: Gabriel Redner (gredner_at_[hidden])
Date: 2011-08-14 10:54:45


Hi all,

I am trying to compile the phoenix::bind example partially laid out here:
http://www.boost.org/doc/libs/1_47_0/libs/phoenix/doc/html/phoenix/modules/bind/binding_functions.html

The code, with #includes and using decls added, is:

==========
#include <boost/phoenix/bind/bind_function.hpp>
#include <boost/phoenix/core/argument.hpp>

#include <iostream>

using namespace boost::phoenix;
using namespace boost::phoenix::placeholders;

void foo(int n)
{
    std::cout << n << std::endl;
}

int main()
{
  bind(&foo, arg1)(4);
}
==========

However, the compiler (g++ 4.4.5) complains:

/home/gredner/main.cpp: In function ‘int main()’:
/home/gredner/main.cpp:16: error: no matching function for call to
‘bind(void (*)(int), const
boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal,
boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&)’

What am I doing wrong? I also tried fully-qualifying 'bind' and
'arg1', but got the same results.

Also, there is no simple bind example under libs/phoenix/examples - in
light of this sort of problem, it would be very nice to have one.

Thanks,
-Gabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net