//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // shared_ptr // template bool owner_before(weak_ptr const& b) const; #include #include int main() { const std::shared_ptr p1(new int); const std::shared_ptr p2 = p1; const std::shared_ptr p3(new int); const std::weak_ptr w1(p1); const std::weak_ptr w2(p2); const std::weak_ptr w3(p3); assert(!p1.owner_before(w2)); assert(!p2.owner_before(w1)); assert(p1.owner_before(w3) || p3.owner_before(w1)); assert(p3.owner_before(w1) == p3.owner_before(w2)); }