Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STL4015: The std::iterator class template is deprecated in C++17 #6283

Closed
YHabotAetrex opened this issue Apr 21, 2020 · 6 comments
Closed

STL4015: The std::iterator class template is deprecated in C++17 #6283

YHabotAetrex opened this issue Apr 21, 2020 · 6 comments

Comments

@YHabotAetrex
Copy link


Required Info
Camera Model D415
Firmware Version 05.11.15.00
Operating System & Version Win 10
Platform PC
SDK Version 2.29.0
Language C++ Visual Sudio 2019 v 16.5.4

Issue Description

Getting a build error in :
\Intel RealSense SDK 2.0\include\librealsense2\hpp\rs_frame.hpp(1102,38): error C4996: 'std::iterator<std::forward_iterator_tag,rs2::frame,ptrdiff_t,rs2::frame *,rs2::frame &>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

@MartyG-RealSense
Copy link
Collaborator

I carefully considered how to label your request to determine how the RealSense team track it. As others have not reported it as something that is breaking their builds, I have labelled it as "Enhancement" (a 'feature request'). This case will remain open so that it can be tracked. I hope that this is a satisfactory approach for you.

@MartyG-RealSense
Copy link
Collaborator

There were no other reports from RealSense users of this problem occurring in the 2 months after this case was created. I will therefore close the case.

@danilogr
Copy link

Hey @MartyG-RealSense, would you mind re-opening this?

My info is similar to @YHabotAetrex, I am using RealSense2 on Windows with a C++17 compiler (Visual Studio v142).

I would also consider renaming this issue. std::iterator class is not deprecated in C++17. C++17 is deprecating inheriting from std::iterator.

The solution, for now, is to define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS, but it would be great to have C++17 compatible code. This blog has a really nice guide on the matter: https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jun 16, 2020

@danilogr Ok, I will re-open it and take another look at it, as the details that you have kindly provided will be helpful for me to possibly file a bug report, given that it is a replicable problem (experienced by more than one RealSense user) and generates warnings.

@ev-mp
Copy link
Collaborator

ev-mp commented Jun 17, 2020

@danilogr , @MartyG-RealSense , I will re-classify this as enhancement request - the SDK is explicitly targeted to C++11 standard.
Being compatible with the next versions of the language is envisaged, yet it is not the same as not being compliant with specifications.

@MartyG-RealSense
Copy link
Collaborator

Hi @YHabotAetrex and @danilogr The issue in this case has now been addressed with a Pull Request that has been merged into the RealSense SDK. I will therefore now close this case. Thanks very much for your reports!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants