boost::bind...again

I have this code:

1
2
3
boost::bind(&util::file::boost_bind::save_container< std::list<Eq_slot*>, Eq_slot_save_func>, _1, _2, *_3, 
	&util::file::boost_bind::save_multiline<Eq_slot>
);


And I am currently getting an error with the *_3 part, stating "Illegal indirection".

I am trying to basically call the save_container function with the 4th arugment bound to save a non-pointer, so I would like to dereference the 3rd argument (which in this case would be an Eq_slot*).

Do I need to create a different save_multiline type function to save pointers in order to do this or is there another thing I do to make this work? (Possibly boost::lambda?)
This works fine with boost::lambda:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

void f(char i, char j, char k, char l)
{
  std::cout << i << ' ' << j << ' ' << k << ' ' << l << std::endl;
}

int main()
{
  using namespace boost::lambda;

  char k = 'k';

  bind(f, _1, _2, *_3, 'l')('i', 'j', &k);
}

My guess is that boost::bind can only permute the arguments and perform substitutions with expressions that do not depend on the arguments. I personally have no experience with neither lambda, nor bind.

Regards
Yes.

*_3 in boost::lambda land is a lambda expression.

*_3 in boost::bind land is a compile error since it is a lambda expression.
Got it, thanks.
Topic archived. No new replies allowed.