Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
9bf9b7be
Commit
9bf9b7be
authored
Apr 12, 2013
by
Davis King
Browse files
Gave array a constructor that takes an initial size parameter
parent
31765e6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
dlib/array/array_kernel.h
dlib/array/array_kernel.h
+13
-0
dlib/array/array_kernel_abstract.h
dlib/array/array_kernel_abstract.h
+13
-0
dlib/test/array.cpp
dlib/test/array.cpp
+5
-0
No files found.
dlib/array/array_kernel.h
View file @
9bf9b7be
...
@@ -89,6 +89,19 @@ namespace dlib
...
@@ -89,6 +89,19 @@ namespace dlib
_at_start
(
true
)
_at_start
(
true
)
{}
{}
explicit
array
(
unsigned
long
new_size
)
:
array_size
(
0
),
max_array_size
(
0
),
array_elements
(
0
),
pos
(
0
),
last_pos
(
0
),
_at_start
(
true
)
{
resize
(
new_size
);
}
~
array
(
~
array
(
);
);
...
...
dlib/array/array_kernel_abstract.h
View file @
9bf9b7be
...
@@ -64,6 +64,19 @@ namespace dlib
...
@@ -64,6 +64,19 @@ namespace dlib
- std::bad_alloc or any exception thrown by T's constructor
- std::bad_alloc or any exception thrown by T's constructor
!*/
!*/
explicit
array
(
unsigned
long
new_size
);
/*!
ensures
- #*this is properly initialized
- #size() == new_size
- #max_size() == new_size
- All elements of the array will have initial values for their type.
throws
- std::bad_alloc or any exception thrown by T's constructor
!*/
~
array
(
~
array
(
);
);
/*!
/*!
...
...
dlib/test/array.cpp
View file @
9bf9b7be
...
@@ -41,6 +41,11 @@ namespace
...
@@ -41,6 +41,11 @@ namespace
array
a1
,
a2
;
array
a1
,
a2
;
{
array
a4
(
4
);
DLIB_TEST
(
a4
.
size
()
==
4
);
}
{
{
array
a1
,
a2
;
array
a1
,
a2
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment