FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Prototype_pattern_exercise/FullArray.cpp at master · cablegui/Prototype_pattern_exercise · GitHub
cablegui
/
Prototype_pattern_exercise
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Prototype_pattern_exercise
/
FullArray.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
88 lines (62 loc) · 1.63 KB
Breadcrumbs
Prototype_pattern_exercise
/
FullArray.cpp
Copy path
File metadata and controls
88 lines (62 loc) · 1.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
FullArray.cpp
//
//
Template class for a normal arrays.
//
//
28 january 1999 RD Started
//
2002-1-21 Indexes starting at 1
//
//
//
(C) Datasim Component Technology 1999
#
ifndef
DSFullArray_cpp
#
define
DSFullArray_cpp
#
include
"
FullArray.hpp
"
//
Constructors & destructor
template
<
class
V
,
class
TA
>
FullArray<V,
TA
>::FullArray(): ArrayStructure<V>()
{
//
Default constructor
m_vector=std::vector<V,
TA
>(
1
);
//
vector object with 1 element
}
template
<
class
V
,
class
TA
>
FullArray<V,
TA
>::FullArray(
size_t
size): ArrayStructure<V>()
{
//
Constructor with size
m_vector=std::vector<V,
TA
>(size);
}
template
<
class
V
,
class
TA
>
FullArray<V,
TA
>::FullArray(
const
FullArray<V,
TA
>& source): ArrayStructure<V>(source)
{
//
Copy constructor
m_vector=source.
m_vector
;
}
template
<
class
V
,
class
TA
>
FullArray<V,
TA
>::
~FullArray
()
{
//
Destructor
}
//
Selectors
template
<
class
V
,
class
TA
>
size_t
FullArray<V,
TA
>::Size()
const
{
//
Size of the array
return
m_vector.
size
();
}
//
Modifiers
//
Operators
template
<
class
V
,
class
TA
>
V& FullArray<V,
TA
>::
operator
[] (
size_t
index)
{
//
Subscripting operator
return
m_vector[index -
1
];
}
template
<
class
V
,
class
TA
>
const
V& FullArray<V,
TA
>::
operator
[] (
size_t
index)
const
{
//
Subscripting operator
return
m_vector[index -
1
];
}
template
<
class
V
,
class
TA
>
FullArray<V,
TA
>& FullArray<V,
TA
>::
operator
= (
const
FullArray<V,
TA
>& source)
{
//
Assignment operator
//
Exit if same object
if
(
this
==&source)
return
*
this
;
//
Call base class constructor
ArrayStructure<V>::
operator
= (source);
//
Copy the embedded vector
m_vector=source.
m_vector
;
return
*
this
;
}
#
endif
//
FullArray_cpp
Back
|
FazBrowse Home
|
New Git URL