Merge pull request #19683 from diablodale:add_defconstruct_noexcept_matumat

This commit is contained in:
Alexander Alekhin 2021-03-11 22:02:06 +00:00
commit c5c2b6f9bf
4 changed files with 24 additions and 24 deletions

View File

@ -576,24 +576,24 @@ CV_ENUM_FLAGS(UMatData::MemoryFlag)
struct CV_EXPORTS MatSize struct CV_EXPORTS MatSize
{ {
explicit MatSize(int* _p); explicit MatSize(int* _p) CV_NOEXCEPT;
int dims() const; int dims() const CV_NOEXCEPT;
Size operator()() const; Size operator()() const;
const int& operator[](int i) const; const int& operator[](int i) const;
int& operator[](int i); int& operator[](int i);
operator const int*() const; // TODO OpenCV 4.0: drop this operator const int*() const CV_NOEXCEPT; // TODO OpenCV 4.0: drop this
bool operator == (const MatSize& sz) const; bool operator == (const MatSize& sz) const CV_NOEXCEPT;
bool operator != (const MatSize& sz) const; bool operator != (const MatSize& sz) const CV_NOEXCEPT;
int* p; int* p;
}; };
struct CV_EXPORTS MatStep struct CV_EXPORTS MatStep
{ {
MatStep(); MatStep() CV_NOEXCEPT;
explicit MatStep(size_t s); explicit MatStep(size_t s) CV_NOEXCEPT;
const size_t& operator[](int i) const; const size_t& operator[](int i) const CV_NOEXCEPT;
size_t& operator[](int i); size_t& operator[](int i) CV_NOEXCEPT;
operator size_t() const; operator size_t() const;
MatStep& operator = (size_t s); MatStep& operator = (size_t s);
@ -807,7 +807,7 @@ public:
The constructed matrix can further be assigned to another matrix or matrix expression or can be The constructed matrix can further be assigned to another matrix or matrix expression or can be
allocated with Mat::create . In the former case, the old content is de-referenced. allocated with Mat::create . In the former case, the old content is de-referenced.
*/ */
Mat(); Mat() CV_NOEXCEPT;
/** @overload /** @overload
@param rows Number of rows in a 2D array. @param rows Number of rows in a 2D array.
@ -2193,7 +2193,7 @@ public:
typedef MatConstIterator_<_Tp> const_iterator; typedef MatConstIterator_<_Tp> const_iterator;
//! default constructor //! default constructor
Mat_(); Mat_() CV_NOEXCEPT;
//! equivalent to Mat(_rows, _cols, DataType<_Tp>::type) //! equivalent to Mat(_rows, _cols, DataType<_Tp>::type)
Mat_(int _rows, int _cols); Mat_(int _rows, int _cols);
//! constructor that sets each matrix element to specified value //! constructor that sets each matrix element to specified value
@ -2385,7 +2385,7 @@ class CV_EXPORTS UMat
{ {
public: public:
//! default constructor //! default constructor
UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT); UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT) CV_NOEXCEPT;
//! constructs 2D matrix of the specified size and type //! constructs 2D matrix of the specified size and type
// (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.) // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT); UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);

View File

@ -1116,11 +1116,11 @@ void Mat::push_back(const std::vector<_Tp>& v)
///////////////////////////// MatSize //////////////////////////// ///////////////////////////// MatSize ////////////////////////////
inline inline
MatSize::MatSize(int* _p) MatSize::MatSize(int* _p) CV_NOEXCEPT
: p(_p) {} : p(_p) {}
inline inline
int MatSize::dims() const int MatSize::dims() const CV_NOEXCEPT
{ {
return (p - 1)[0]; return (p - 1)[0];
} }
@ -1153,13 +1153,13 @@ int& MatSize::operator[](int i)
} }
inline inline
MatSize::operator const int*() const MatSize::operator const int*() const CV_NOEXCEPT
{ {
return p; return p;
} }
inline inline
bool MatSize::operator != (const MatSize& sz) const bool MatSize::operator != (const MatSize& sz) const CV_NOEXCEPT
{ {
return !(*this == sz); return !(*this == sz);
} }
@ -1169,25 +1169,25 @@ bool MatSize::operator != (const MatSize& sz) const
///////////////////////////// MatStep //////////////////////////// ///////////////////////////// MatStep ////////////////////////////
inline inline
MatStep::MatStep() MatStep::MatStep() CV_NOEXCEPT
{ {
p = buf; p[0] = p[1] = 0; p = buf; p[0] = p[1] = 0;
} }
inline inline
MatStep::MatStep(size_t s) MatStep::MatStep(size_t s) CV_NOEXCEPT
{ {
p = buf; p[0] = s; p[1] = 0; p = buf; p[0] = s; p[1] = 0;
} }
inline inline
const size_t& MatStep::operator[](int i) const const size_t& MatStep::operator[](int i) const CV_NOEXCEPT
{ {
return p[i]; return p[i];
} }
inline inline
size_t& MatStep::operator[](int i) size_t& MatStep::operator[](int i) CV_NOEXCEPT
{ {
return p[i]; return p[i];
} }
@ -1210,7 +1210,7 @@ inline MatStep& MatStep::operator = (size_t s)
////////////////////////////// Mat_<_Tp> //////////////////////////// ////////////////////////////// Mat_<_Tp> ////////////////////////////
template<typename _Tp> inline template<typename _Tp> inline
Mat_<_Tp>::Mat_() Mat_<_Tp>::Mat_() CV_NOEXCEPT
: Mat() : Mat()
{ {
flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value; flags = (flags & ~CV_MAT_TYPE_MASK) + traits::Type<_Tp>::value;

View File

@ -204,7 +204,7 @@ MatAllocator* Mat::getStdAllocator()
//================================================================================================== //==================================================================================================
bool MatSize::operator==(const MatSize& sz) const bool MatSize::operator==(const MatSize& sz) const CV_NOEXCEPT
{ {
int d = dims(); int d = dims();
int dsz = sz.dims(); int dsz = sz.dims();
@ -337,7 +337,7 @@ void finalizeHdr(Mat& m)
//======================================= Mat ====================================================== //======================================= Mat ======================================================
Mat::Mat() Mat::Mat() CV_NOEXCEPT
: flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
datalimit(0), allocator(0), u(0), size(&rows), step(0) datalimit(0), allocator(0), u(0), size(&rows), step(0)
{} {}

View File

@ -230,7 +230,7 @@ UMatDataAutoLock::~UMatDataAutoLock()
//////////////////////////////// UMat //////////////////////////////// //////////////////////////////// UMat ////////////////////////////////
UMat::UMat(UMatUsageFlags _usageFlags) UMat::UMat(UMatUsageFlags _usageFlags) CV_NOEXCEPT
: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows) : flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
{} {}