File indexing completed on 2024-04-06 12:31:41
0001 #include "TrackingTools/TrajectoryState/interface/ChurnAllocator.h"
0002
0003 #include <iostream>
0004
0005 struct A {
0006 virtual ~A() {}
0007 };
0008 struct B : public A {
0009 ~B() { std::cout << "D B " << this << std::endl; }
0010 explicit B(int) { std::cout << "C B " << this << std::endl; }
0011 };
0012 struct C : public A {
0013 ~C() { std::cout << "D c " << this << std::endl; }
0014 explicit C(int, float) { std::cout << "C B " << this << std::endl; }
0015 };
0016
0017 int main(int k, const char **) {
0018 using PA = std::shared_ptr<A>;
0019
0020
0021
0022 PA b = std::allocate_shared<B>(churn_allocator<B>(), 3);
0023 PA c = std::allocate_shared<C>(churn_allocator<C>(), 3, -2.3);
0024 std::cout << "more " << std::endl;
0025 PA b1 = std::allocate_shared<B>(churn_allocator<B>(), 3);
0026 PA c1 = std::allocate_shared<C>(churn_allocator<C>(), 3, -2.3);
0027 if (k < 3) {
0028 b1.reset();
0029 c.reset();
0030 std::cout << "churn " << std::endl;
0031 b1 = std::allocate_shared<B>(churn_allocator<B>(), 3);
0032 c = std::allocate_shared<C>(churn_allocator<C>(), 3, -2.3);
0033 b1.reset();
0034 c.reset();
0035 }
0036
0037 std::cout << "end " << std::endl;
0038
0039 return 0;
0040 }