Skip to content

Commit 7be0c78

Browse files
patrikhuberalalek
authored andcommitted
Merge pull request opencv#10589 from patrikhuber:patch-1
* Make <array> #ifdef true for MSVC I think MSVC had `std::array` for quite a while (possibly going back as far as VS 2012, but it's definitely there in 2015 and 2017. So I think `_MSC_VER` `1900` is a safe bet. Probably `1800` and maybe even `1700` could work as well but I can't test that locally. * fix test
1 parent 0e4eed0 commit 7be0c78

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

modules/core/include/opencv2/core/cvdef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ Cv64suf;
442442
\****************************************************************************************/
443443

444444
#ifndef CV_CXX_STD_ARRAY
445-
# if __cplusplus >= 201103L
445+
# if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
446446
# define CV_CXX_STD_ARRAY 1
447447
# include <array>
448448
# endif

modules/core/test/test_mat.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,9 +1672,9 @@ TEST(Core_Mat_array, copyTo_roi_row)
16721672
TEST(Core_Mat_array, SplitMerge)
16731673
{
16741674
std::array<cv::Mat, 3> src;
1675-
for(size_t i=0; i<src.size(); ++i) {
1676-
src[i].create(10, 10, CV_8U);
1677-
src[i] = 127 * i;
1675+
for (size_t i = 0; i < src.size(); ++i)
1676+
{
1677+
src[i] = Mat(10, 10, CV_8U, Scalar((double)(16 * (i + 1))));
16781678
}
16791679

16801680
Mat merged;
@@ -1683,10 +1683,9 @@ TEST(Core_Mat_array, SplitMerge)
16831683
std::array<cv::Mat, 3> dst;
16841684
split(merged, dst);
16851685

1686-
Mat diff;
1687-
for(size_t i=0; i<dst.size(); ++i) {
1688-
absdiff(src[i], dst[i], diff);
1689-
EXPECT_EQ(0, countNonZero(diff));
1686+
for (size_t i = 0; i < dst.size(); ++i)
1687+
{
1688+
EXPECT_EQ(0, cvtest::norm(src[i], dst[i], NORM_INF));
16901689
}
16911690
}
16921691
#endif

0 commit comments

Comments
 (0)