Lines Matching refs:fbl

5 #include <fbl/alloc_checker.h>
6 #include <fbl/ref_counted.h>
7 #include <fbl/ref_ptr.h>
8 #include <fbl/type_support.h>
55 static_assert(fbl::is_standard_layout<fbl::RefPtr<RefCallCounter>>::value,
56 "fbl::RefPtr<T>'s should have a standard layout.");
60 using RefCallPtr = fbl::RefPtr<RefCallCounter>;
63 RefCallPtr ptr = fbl::AdoptRef<RefCallCounter>(&counter);
111 RefCallPtr ptr2 = fbl::move(ptr);
137 using RefCallPtr = fbl::RefPtr<RefCallCounter>;
141 RefCallPtr ptr1 = fbl::AdoptRef<RefCallCounter>(&obj1);
142 RefCallPtr ptr2 = fbl::AdoptRef<RefCallCounter>(&obj2);
282 void PassByCopy(fbl::RefPtr<A>) { result_ = Result::ClassA; }
283 void PassByCopy(fbl::RefPtr<D>) { result_ = Result::ClassD; }
287 // due to ambiguity (it does not know whether to cast fbl::RefPtr<C> to fbl::RefPtr<A>
288 // or fbl::RefPtr<B>)
289 void PassByCopy(fbl::RefPtr<B>) { result_ = Result::ClassB; }
292 void PassByMove(fbl::RefPtr<A>&&) { result_ = Result::ClassA; }
293 void PassByMove(fbl::RefPtr<D>&&) { result_ = Result::ClassD; }
297 // due to ambiguity (it does not know whether to cast fbl::RefPtr<C> to fbl::RefPtr<A>
298 // or fbl::RefPtr<B>)
299 void PassByMove(fbl::RefPtr<B>&&) { result_ = Result::ClassB; }
312 fbl::AllocChecker ac;
314 fbl::RefPtr<Derived> derived_ptr;
318 derived_ptr = fbl::AdoptRef<Derived>(new (&ac) Derived());
327 fbl::RefPtr<Base> base_ptr(derived_ptr);
345 fbl::RefPtr<Base> base_ptr(fbl::move(derived_ptr));
362 derived_ptr = fbl::AdoptRef<Derived>(new (&ac) Derived());
371 fbl::RefPtr<Base> base_ptr = derived_ptr;
381 // Assign RefPtr<Base> at declaration time with a fbl::move
389 fbl::RefPtr<Base> base_ptr = fbl::move(derived_ptr);
406 derived_ptr = fbl::AdoptRef<Derived>(new (&ac) Derived());
415 fbl::RefPtr<Base> base_ptr;
426 // Assign RefPtr<Base> after declaration with a fbl::move
434 fbl::RefPtr<Base> base_ptr;
435 base_ptr = fbl::move(derived_ptr);
452 derived_ptr = fbl::AdoptRef<Derived>(new (&ac) Derived());
467 bool test_res = handoff_lvalue_fn<fbl::RefPtr<Base>>(derived_ptr);
479 bool test_res = handoff_copy_fn<fbl::RefPtr<Base>>(derived_ptr);
491 bool test_res = handoff_rvalue_fn<fbl::RefPtr<Base>>(fbl::move(derived_ptr));
532 fbl::AllocChecker ac;
533 fbl::RefPtr<C> ptr = fbl::AdoptRef(new (&ac) C());
549 helper.PassByMove(fbl::move(ptr));
563 class C : public fbl::RefCounted<C> {
566 fbl::RefPtr<C> ptr = fbl::AdoptRef(static_cast<C*>(nullptr));
574 class C : public fbl::RefCounted<C> {
584 fbl::AllocChecker ac;
585 fbl::RefPtr<C> refptr = fbl::AdoptRef<C>(new (&ac) C(23));
589 fbl::RefPtr<const C> const_refptr = refptr;
598 fbl::RefPtr<const C> moved_const_refptr = fbl::move(refptr);
606 const_refptr = fbl::move(moved_const_refptr);
615 using RefCallPtr = fbl::RefPtr<RefCallCounter>;
618 RefCallPtr ptr1 = fbl::AdoptRef<RefCallCounter>(&counter1);
619 RefCallPtr ptr2 = fbl::AdoptRef<RefCallCounter>(&counter2);
625 ptr1 = fbl::move(ptr2);
633 ptr1 = fbl::move(ptr1);