boostorg / range

Boost.org range module
http://boost.org/libs/range
43 stars 104 forks source link

Is this a bug in irange.hpp #87

Open PatrickMGrace opened 5 years ago

PatrickMGrace commented 5 years ago

Lines 166 to 169 in irange.hpp: 166 reference dereference() const 167 { 168 return m_first + (m_step * m_step_size); 169 } This looks like it is returning a reference to a temporary. Undefined behaviour?

PatrickMGrace commented 5 years ago

On closer inspection it seems to be OK as reference and value_type are both defined the same, i.e. Integer. However, it would be clearer if "reference" was replaced with "value_type" as the return type of the function.