Commit 8984f754 authored by Davis King's avatar Davis King

Added operator= that takes an initializer_list so that = assignments always

behave in the way you would expect.
parent e9fa6539
...@@ -1163,6 +1163,12 @@ namespace dlib ...@@ -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) matrix(matrix&& item)
{ {
......
...@@ -494,6 +494,19 @@ namespace dlib ...@@ -494,6 +494,19 @@ namespace dlib
- returns *this - 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> template <typename EXP>
matrix& operator= ( matrix& operator= (
const matrix_exp<EXP>& m const matrix_exp<EXP>& m
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment