Skip to content

Make <array> #ifdef true for MSVC - #10589

Merged
alalek merged 2 commits into
opencv:masterfrom
patrikhuber:patch-1
Feb 17, 2018
Merged

alalek merged 2 commits into
opencv:masterfrom
patrikhuber:patch-1

Conversation

@patrikhuber

Copy link
Copy Markdown
Contributor

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.

@alalek

alalek commented Jan 14, 2018

Copy link
Copy Markdown
Member

Looks good.
Consider using of _MSVC_LANG to detect C++ features instead of _MSC_VER (see #9231)
You need to fix compiler warnings in related code too.

@vpisarev

vpisarev commented Feb 5, 2018

Copy link
Copy Markdown
Contributor

we are moving towards enabling C++ 11, and so because there are no updates to fix the warnings, let's close it for now

patrikhuber and others added 2 commits February 16, 2018 12:35
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.
@alalek
alalek merged commit 7be0c78 into opencv:master Feb 17, 2018
@patrikhuber
patrikhuber deleted the patch-1 branch February 17, 2018 12:34
@mwoehlke-kitware

Copy link
Copy Markdown

So... this broke C consumers.

The check used to be "if using C++ ≥ C++11". This changed it to "if (using C++ ≥ C++11) or (using MSVC ≥ VS2015)". The problem is, that second check doesn't actually check that you're using C++, and so breaks C consumers of OpenCV (when compiled with MSVC).

SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants