Action_Thermostats
        Add_AtomRandomPerturbation
        Add_SelectAtomByNameAction
        Adding_Graph_to_ChangeBondActions
        Adding_MD_integration_tests
        Adding_StructOpt_integration_tests
        AutomationFragmentation_failures
        Candidate_v1.6.1
        Candidate_v1.7.0
        ChangeBugEmailaddress
        ChemicalSpaceEvaluator
        EmpiricalPotential_contain_HomologyGraph_documentation
        Enhance_userguide
        Enhanced_StructuralOptimization
        Enhanced_StructuralOptimization_continued
        Example_ManyWaysToTranslateAtom
        Exclude_Hydrogens_annealWithBondGraph
        Fix_Verbose_Codepatterns
        ForceAnnealing_oldresults
        ForceAnnealing_with_BondGraph
        ForceAnnealing_with_BondGraph_continued
        ForceAnnealing_with_BondGraph_continued_betteresults
        ForceAnnealing_with_BondGraph_contraction-expansion
        GeometryObjects
        Gui_displays_atomic_force_velocity
        IndependentFragmentGrids_IntegrationTest
        JobMarket_RobustOnKillsSegFaults
        JobMarket_StableWorkerPool
        PythonUI_with_named_parameters
        QtGui_reactivate_TimeChanged_changes
        Recreated_GuiChecks
        StoppableMakroAction
        TremoloParser_IncreasedPrecision
        TremoloParser_MultipleTimesteps
        stable
      
      
      
| Rev | Line |   | 
|---|
| [0b990d] | 1 | 
 | 
|---|
 | 2 | #include <iostream>
 | 
|---|
 | 3 | #include <util/misc/autovec.h>
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | using namespace sc;
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | class A {
 | 
|---|
 | 8 |     int me;
 | 
|---|
 | 9 |     static int nA;
 | 
|---|
 | 10 |   public:
 | 
|---|
 | 11 |     A() {
 | 
|---|
 | 12 |       me = nA++;
 | 
|---|
 | 13 |       std::cout << "A::A (" << me << ")" << std::endl;
 | 
|---|
 | 14 |     }
 | 
|---|
 | 15 |     ~A() {
 | 
|---|
 | 16 |       std::cout << "A::~A (" << me << ")" << std::endl;
 | 
|---|
 | 17 |     }
 | 
|---|
 | 18 | };
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | int A::nA = 0;
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 | void
 | 
|---|
 | 23 | expect(const std::string &m)
 | 
|---|
 | 24 | {
 | 
|---|
 | 25 |   std::cout << "expect " << m << ": ";
 | 
|---|
 | 26 | }
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | main()
 | 
|---|
 | 29 | {
 | 
|---|
 | 30 |   auto_vec<double> double_data(new double[4]);
 | 
|---|
 | 31 |   double_data.release();
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 |   {
 | 
|---|
 | 34 |     expect("A::A (0)");
 | 
|---|
 | 35 |     auto_vec<A> a(new A[1]);
 | 
|---|
 | 36 |     auto_vec<A> b(a);
 | 
|---|
 | 37 |     expect("A::~A (0)");
 | 
|---|
 | 38 |     b.reset();
 | 
|---|
 | 39 |   }
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 |   {
 | 
|---|
 | 42 |     expect("A::A (1)");
 | 
|---|
 | 43 |     auto_vec<A> a(new A[1]);
 | 
|---|
 | 44 |     expect("A::A (2)");
 | 
|---|
 | 45 |     auto_vec<A> b(new A[1]);
 | 
|---|
 | 46 |     expect("A::~A (2)");
 | 
|---|
 | 47 |     b = a;
 | 
|---|
 | 48 |     expect("A::~A (1)");
 | 
|---|
 | 49 |     b.reset();
 | 
|---|
 | 50 |   }
 | 
|---|
 | 51 | 
 | 
|---|
 | 52 |   {
 | 
|---|
 | 53 |     expect("A::A (3)");
 | 
|---|
 | 54 |     auto_vec<A> a(new A[1]);
 | 
|---|
 | 55 |     expect("A::~A (3)");
 | 
|---|
 | 56 |   }
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 |   {
 | 
|---|
 | 59 |     expect("A::A (4)");
 | 
|---|
 | 60 |     auto_vec<A> a(new A[1]);
 | 
|---|
 | 61 |     auto_vec<A> b(a.release());
 | 
|---|
 | 62 |     expect("A::~A (4)");
 | 
|---|
 | 63 |   }
 | 
|---|
 | 64 | 
 | 
|---|
 | 65 |   {
 | 
|---|
 | 66 |     expect("A::A (5)");
 | 
|---|
 | 67 |     auto_vec<A> a(new A[1]);
 | 
|---|
 | 68 |     expect("A::A (6)");
 | 
|---|
 | 69 |     A *ap = new A[1];
 | 
|---|
 | 70 |     expect("A::~A (5)");
 | 
|---|
 | 71 |     a.reset(ap);
 | 
|---|
 | 72 |     expect("A::~A (6)");
 | 
|---|
 | 73 |   }
 | 
|---|
 | 74 | 
 | 
|---|
 | 75 |   return 0;
 | 
|---|
 | 76 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.