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
65af5bfb
Commit
65af5bfb
authored
Oct 01, 2011
by
Davis King
Browse files
Added a constructor to array2d that lets you set its size.
parent
6db9eb73
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
dlib/array2d/array2d_kernel_1.h
dlib/array2d/array2d_kernel_1.h
+25
-0
dlib/array2d/array2d_kernel_abstract.h
dlib/array2d/array2d_kernel_abstract.h
+17
-0
No files found.
dlib/array2d/array2d_kernel_1.h
View file @
65af5bfb
...
...
@@ -143,6 +143,31 @@ namespace dlib
{
}
array2d
(
long
nr__
,
long
nc__
)
:
nc_
(
0
),
nr_
(
0
),
rows
(
0
),
data
(
0
),
cur
(
0
),
last
(
0
),
at_start_
(
true
)
{
// make sure requires clause is not broken
DLIB_ASSERT
((
nc__
>
0
&&
nr__
>
0
)
||
(
nc__
==
0
&&
nr__
==
0
),
"
\t
array2d::array2d(long nr__, long nc__)"
<<
"
\n\t
You have to give a non zero nc and nr or just make both zero."
<<
"
\n\t
this: "
<<
this
<<
"
\n\t
nc__: "
<<
nc__
<<
"
\n\t
nr__: "
<<
nr__
);
set_size
(
nr__
,
nc__
);
}
virtual
~
array2d
(
)
{
clear
();
}
...
...
dlib/array2d/array2d_kernel_abstract.h
View file @
65af5bfb
...
...
@@ -124,6 +124,23 @@ namespace dlib
- std::bad_alloc
!*/
array2d
(
long
rows
,
long
cols
);
/*!
requires
- cols > 0 && rows > 0 or
cols == 0 && rows == 0
ensures
- #nc() == cols
- #nr() == rows
- #at_start() == true
- all elements in this array have initial values for their type
throws
- std::bad_alloc
!*/
virtual
~
array2d
(
);
/*!
...
...
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