Prevent_deref shall not return a reference to the iterator as it can be copied

iterator being taken by copy usually, if a function takes a
an iterator by copy and that function returns the reference
type of the deref operator then a reference to a temporary
will be returned.
This commit is contained in:
Sébastien Loriot 2022-10-24 17:58:52 +02:00
parent 2321427500
commit 7c4123152b
1 changed files with 4 additions and 0 deletions

View File

@ -43,6 +43,8 @@ class Prevent_deref
Prevent_deref<I>
, I // base
, I // value
, boost::use_default
, I
>
{
public:
@ -50,6 +52,8 @@ public:
Prevent_deref<I>
, I // base
, I // value
, boost::use_default
, I
> Base;
typedef typename Base::reference reference;
typedef typename std::pair<I, I> range;