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
8984f754
Commit
8984f754
authored
Apr 18, 2016
by
Davis King
Browse files
Added operator= that takes an initializer_list so that = assignments always
behave in the way you would expect.
parent
e9fa6539
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
dlib/matrix/matrix.h
dlib/matrix/matrix.h
+6
-0
dlib/matrix/matrix_abstract.h
dlib/matrix/matrix_abstract.h
+13
-0
No files found.
dlib/matrix/matrix.h
View file @
8984f754
...
...
@@ -1163,6 +1163,12 @@ namespace dlib
}
matrix
&
operator
=
(
const
std
::
initializer_list
<
T
>&
l
)
{
matrix
temp
(
l
);
temp
.
swap
(
*
this
);
return
*
this
;
}
matrix
(
matrix
&&
item
)
{
...
...
dlib/matrix/matrix_abstract.h
View file @
8984f754
...
...
@@ -494,6 +494,19 @@ namespace dlib
- returns *this
!*/
matrix
&
operator
=
(
const
std
::
initializer_list
<
T
>&
l
);
/*!
requires
- This matrix is capable of having a size() == l.size(). Therefore, if
NR*NC != 0 then l.size() must equal NR*NC. Alternatively, if NR or NC is
!= 0 then l.size() must be a multiple of the non-zero NR or NC.
ensures
- Assigns the contents of l to *this by performing: matrix(l).swap(*this)
- returns *this
!*/
template
<
typename
EXP
>
matrix
&
operator
=
(
const
matrix_exp
<
EXP
>&
m
...
...
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