09/04/23 02:53:07
あ、本当だ。ごめん。こうしないと死なないね。
まあ、マルチスレッドでもなきゃやらんだろうけど。
struct A {
A() : s(new std::string) {};
boost::shared_ptr<string> s;
}
void doom(std::auto_ptr<A> body, boost::shared_ptr<string>& str) {
{
std::auto_ptr<A> b(body);
}
*str; // boo!!
};
int main() {
std::auto_ptr<A> a(new A);
doom(a, a->s);
}