1

I am using boost::protect many times in my templates to binding functions. Is it in the new standard? I haven't found it. As I see std::forward do something similar.

Many thanks for help!

Example: path through a functor to a bind:

class C
{
public:
  void method1(int i);
};

class B
{
public:
   void method2(const boost::function<void(int)>&);
};
...
B* b_ptr;
C* c_ptr;
...
// when func() is called C::method1 of c_ptr is pass through to B::method2 of b_ptr
boost::function<void(void)> func(boost::bind(&B::method2,b_ptr,boost::protect(boost::bind(&C::method1,c_ptr,_1))));
Naszta
  • 7,560
  • 2
  • 33
  • 49
  • Could you make this question self-contained? I think it's a bit of an obstacle if we have to go to an external website to read up on some fairly subtle problem and an implementation of its solution. What problem are you trying to solve? – Kerrek SB Jun 25 '14 at 09:23
  • [Possibly interesting.](http://stackoverflow.com/questions/18519087/why-is-there-no-stdprotect) – llonesmiz Jun 25 '14 at 09:37
  • Not sure about the edit. When I ask for an rewording, I almost never mean "just tack on some stuff at the end". Rather, I had in mind a complete rewrite that produces a cohesive narrative: A brief introduction to what `protect` is and what problem it solves, example code, a statement of your problem, and then the question you have. Piling code dumps up higher and deeper doesn't necessarily make the question better. Anyway, it's your call. – Kerrek SB Jun 25 '14 at 09:41

0 Answers0