Boost logo

Boost :

From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2023-12-02 20:12:10


Hi All,
Two observations from reading the docs.

Why do I need a condition in scope_exit when I have a scope_fail?

I recommend putting warning somewhere in the docs that while using scope
guards you may inadvertently read an object after move:

std::string checked(std::string name)
{
  scope::scope_exit g{[&]{
    std::clog << "checked " << name <<std::endl;
  }};

  validate(name);
  return name; // name becomes moved-from
}

Regards,
&rzej;


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