Action_Thermostats
Add_AtomRandomPerturbation
Add_RotateAroundBondAction
Add_SelectAtomByNameAction
Adding_Graph_to_ChangeBondActions
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
AutomationFragmentation_failures
Candidate_v1.6.0
Candidate_v1.6.1
ChangeBugEmailaddress
ChangingTestPorts
ChemicalSpaceEvaluator
Combining_Subpackages
Debian_Package_split
Debian_package_split_molecuildergui_only
Disabling_MemDebug
Docu_Python_wait
EmpiricalPotential_contain_HomologyGraph_documentation
Enable_parallel_make_install
Enhance_userguide
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Example_ManyWaysToTranslateAtom
Exclude_Hydrogens_annealWithBondGraph
FitPartialCharges_GlobalError
Fix_ChronosMutex
Fix_StatusMsg
Fix_StepWorldTime_single_argument
Fix_Verbose_Codepatterns
ForceAnnealing_goodresults
ForceAnnealing_oldresults
ForceAnnealing_tocheck
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
JobMarket_unresolvable_hostname_fix
ODR_violation_mpqc_open
PartialCharges_OrthogonalSummation
PythonUI_with_named_parameters
QtGui_reactivate_TimeChanged_changes
Recreated_GuiChecks
RotateToPrincipalAxisSystem_UndoRedo
StoppableMakroAction
Subpackage_levmar
Subpackage_vmg
ThirdParty_MPQC_rebuilt_buildsystem
TremoloParser_IncreasedPrecision
TremoloParser_MultipleTimesteps
Ubuntu_1604_changes
stable
Line | |
---|
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.