Using std::iterator as base class is deprecated in C++17, causes warnings in MSVC++

Open Beginner friendly
#20 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
tooling

Research direction

Inspect include/boost/statechart/state_machine.hpp around line 359, where std::iterator is used, and compare the related Boost.Utility issue for the established migration approach. Build the project with MSVC++ in C++17 mode and verify that the deprecation warning no longer requires _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING.

Written by the indexing model from the issue text.

Description

The following code requires an explicit macro to suppress a warning to be defined when compiling with MSVC++:

https://github.com/boostorg/statechart/blob/586445b824c5cf0e7e6ce4ff2df620fda5d0f0d7/include/boost/statechart/state_machine.hpp#L359

Adding _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING solves the problem as a workaround. Other Boost libraries have fixed this issue in the past, for example: https://github.com/boostorg/utility/issues/34

Can provide PR if needed.

Background info:
https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/

Dominant language
C++
Stars
32
Forks
43
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/statechart

All issues in boostorg/statechart

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.