views:

166

answers:

1

I'm using phoenix::bind and receiving this error message:

error C2039: 'bind' : is not a member of 'phoenix'

The code line where I'm using bind and where the error is pointing is:

phoenix::bind( &OptionalInputPort::eraseDataEditor ) ( phoenix::var( *optionalPort ) )

and I can't figure out what is the problem.

the phoenix include is this line: #include boost/spirit/home/phoenix.hpp

Thanks.

+1  A: 

The phoenix namespace is inside the boost namespace (just like everything else in Boost).

boost::phoenix::bind( &OptionalInputPort::eraseDataEditor ) ( boost::phoenix::var( *optionalPort ) )

To avoid all that typing, you could preface your C++ file with this to create a namespace alias:

namespace phoenix = boost::phoenix;

Then your original code should work. If you're using bind a lot, you could tell your compiler that when you say bind, you mean the one in boost::phoenix:

using boost::phoenix::bind;

If you're using lots of stuff from Phoenix, you could just bring in everything from that namespace, although that can have unintended consequences since it will include the stuff that you didn't even know existed, and that could interfere with your own code.

using namespace boost::phoenix;
Rob Kennedy