syntheticoperators.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 #include "mem_node.h"
11 #include "stmem.h"
12 
13 #include <iostream>
14 
16 {
17 public:
18  HasExplicit();
19  ~HasExplicit();
20  HasExplicit(HasExplicit const &);
22  static int const &Instances();
23  static int const &Assignments();
24  static void Assignments(int const &);
25 private:
26  static void AddInstance();
27  static void RemoveInstance();
28  static void Assignment();
29  static int Instances_;
30  static int Assignments_;
31 };
32 
35 
37 {
38  AddInstance();
39 }
40 
42 {
44 }
45 
47 {
48  AddInstance();
49 }
50 
53 {
54  Assignment();
55  return *this;
56 }
57 
58 void
60 {
61  ++Instances_;
62 }
63 
64 void
66 {
67  --Instances_;
68 }
69 
70 void
72 {
73  ++Assignments_;
74 }
75 
76 int const &
78 {
79  return Instances_;
80 }
81 
82 int const &
84 {
85  return Assignments_;
86 }
87 
88 void
89 HasExplicit::Assignments(int const &newValue)
90 {
91  Assignments_ = newValue;
92 }
93 
94 static void
96 {
100  HasExplicit *two = new HasExplicit;
102  *two = *one;
105  *two = *one;
108  HasExplicit *three = new HasExplicit(*two);
110  delete three;
112  delete one;
114  delete two;
118 }
119 
121 {
122 public:
124 };
125 
126 static void
128 {
135  *two = *one;
138  *two = *one;
143  delete three;
145  delete one;
147  delete two;
151 }
152 
153 int
154 main(int, char *[])
155 {
158  return EXIT_SUCCESS;
159 }
160 
static const int & Assignments()
static const int & Instances()
HasExplicit & operator=(HasExplicit const &)
static void Assignment()
static void AddInstance()
static void RemoveInstance()
static void CheckHasExplicitWorks()
#define assert(EX)
Definition: assert.h:17
static int Instances_
static int Assignments_
int main(int, char *[])
static void CheckSyntheticWorks()

 

Introduction

Documentation

Support

Miscellaneous