mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
Restrict std::initializer_list constructors to arithmetic types.
This commit is contained in:
parent
4ee3034496
commit
3571e8f263
@ -53,6 +53,10 @@
|
|||||||
|
|
||||||
#include "opencv2/core/bufferpool.hpp"
|
#include "opencv2/core/bufferpool.hpp"
|
||||||
|
|
||||||
|
#ifdef CV_CXX11
|
||||||
|
#include <type_traits>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -988,7 +992,8 @@ public:
|
|||||||
#ifdef CV_CXX11
|
#ifdef CV_CXX11
|
||||||
/** @overload
|
/** @overload
|
||||||
*/
|
*/
|
||||||
template<typename _Tp> explicit Mat(const std::initializer_list<_Tp> list);
|
template<typename _Tp, typename = typename std::enable_if<std::is_arithmetic<_Tp>::value>::type>
|
||||||
|
explicit Mat(const std::initializer_list<_Tp> list);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CV_CXX_STD_ARRAY
|
#ifdef CV_CXX_STD_ARRAY
|
||||||
|
@ -575,7 +575,7 @@ Mat::Mat(const std::vector<_Tp>& vec, bool copyData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CV_CXX11
|
#ifdef CV_CXX11
|
||||||
template<typename _Tp> inline
|
template<typename _Tp, typename> inline
|
||||||
Mat::Mat(const std::initializer_list<_Tp> list)
|
Mat::Mat(const std::initializer_list<_Tp> list)
|
||||||
: flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows((int)list.size()),
|
: flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows((int)list.size()),
|
||||||
cols(1), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0)
|
cols(1), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows), step(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user