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

[C++17] std::iterator error #9876

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion include/librealsense2/hpp/rs_frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,17 @@ namespace rs2
throw error("Requested index is out of range!");
}

class iterator : public std::iterator<std::forward_iterator_tag, frame>
class iterator
{
public:
// inheriting from std::iterator template is deprecated in C++17, this is the new way to define an iterator
// go to https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/ for more info
using iterator_category = std::forward_iterator_tag;
using value_type = frame;
using difference_type = std::ptrdiff_t;
using pointer = frame*;
using reference = frame&;

iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
iterator& operator++() { ++_index; return *this; }
bool operator==(const iterator& other) const { return _index == other._index; }
Expand Down