QCustomPlot Discussion and Comments

Recently updated to Visual Studio 2022 v17.8.3 now project won't buildReturn to overview

It complains about qcustomplot with the following warning (we have warning as errors turned on):

stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.

I added the preprocessor variable, and it works for now but would be nice to get it fixed.

Hi Jerrod,

Thanks for the feedback! Could you point me to where this warning is issued?

QCustomPlot does not explicitly use stdext::un/checked_array_iterator, as it is a non-portable microsoft extension to C++. So I assume it comes from windows-specific Qt code, and is an issue between the Qt Version you are using and the compiler version. Perhaps triggered by a Qt construct that QCustomPlot then uses. (At least judging from similar issues in other projects, like https://github.com/microsoft/cpprestsdk/issues/1768)

You are correct. After looking deeper into it looks like it is more QVector<QString>. However, I'm not sure why it is only failing when compiling qcustomplot, we use those elsewhere and there isn't any issues.

5>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\iterator(1470,58):
5>see declaration of 'stdext::checked_array_iterator'
5>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\xutility(1141,31):
5>the template instantiation context (the oldest one first) is
5> C:\dev\ORCA\3.0\ODC\WidgetsLib\Common\qcustomplot.h(2341,20):
5> see reference to class template instantiation 'QVector<T>' being compiled
5> with
5> [
5> T=QString
5> ]
5> C:\Qt\Qt5.15.2\5.15.2\msvc2019\include\QtCore\qvector.h(952,1):
5> while compiling class template member function 'bool QVector<T>::operator ==(const QVector<T> &) const'
5> with
5> [
5> T=QString
5> ]
5> C:\dev\ORCA\3.0\ODC\WidgetsLib\Common\qcustomplot.cpp(9738,22):
5> see the first reference to 'QVector<T>::operator ==' in 'QCPAxis::setupTickVectors'
5> with
5> [
5> T=QString
5> ]
5> C:\Qt\Qt5.15.2\5.15.2\msvc2019\include\QtCore\qvector.h(960,17):
5> see reference to function template instantiation 'bool std::equal<const T*,stdext::checked_array_iterator<const T *>>(const _InIt1,const _InIt1,const _InIt2)' being compiled
5> with
5> [
5> T=QString,
5> _InIt1=const QString *,
5> _InIt2=stdext::checked_array_iterator<const QString *>
5> ]

One idea would be that by chance the qcustomplot compilation unit is the first one to instantiate the QVector<QString> template, and as such the warning is issued there first and suppressed afterwards. This depends on some warning settings.

I've checked all usages of QVector<QString> in QCustomPlot (they're all related to tick labels), and couldn't spot anything remotely extraordinary...