Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Return value of operator* should be reference/const_reference #2

Open
fuchsto opened this issue Jul 11, 2018 · 0 comments
Open

Return value of operator* should be reference/const_reference #2

fuchsto opened this issue Jul 11, 2018 · 0 comments

Comments

@fuchsto
Copy link
Collaborator

fuchsto commented Jul 11, 2018

RVO will probably save your derrière but you have to define reference for iterator traits to work anyways:

const ValueT operator*() const { return _con[_offset]; }

Well, or use decltype(auto). Actually you are missing all iterator member types required by iterator traits:

https://de.cppreference.com/w/cpp/iterator/iterator_traits

Namely:

Iterator::difference_type
Iterator::value_type
Iterator::pointer
Iterator::reference
Iterator::iterator_category
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant