Skip to content

Commit 1bbe5a4

Browse files
author
Ryan Haining
committed
Removes cv qualifiers from DerefHolder when storing value
1 parent 392734a commit 1bbe5a4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cppitertools/internal/iterbase.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,8 @@ namespace iter {
262262
std::is_same<T, U>::value && are_same<T, Ts...>::value> {};
263263

264264
// DerefHolder holds the value gotten from an iterator dereference
265-
// if the iterate dereferences to an lvalue references, a pointer to the
266-
// element is stored
267-
// if it does not, a value is stored instead
265+
// if the iterator dereferences to an lvalue references, a pointer to the
266+
// element is stored. if it does not, a value is stored instead
268267
// get() returns a reference to the held item
269268
// get_ptr() returns a pointer to the held item
270269
// reset() replaces the currently held item
@@ -274,7 +273,7 @@ namespace iter {
274273
static_assert(!std::is_lvalue_reference<T>::value,
275274
"Non-lvalue-ref specialization used for lvalue ref type");
276275
// it could still be an rvalue reference
277-
using TPlain = std::remove_reference_t<T>;
276+
using TPlain = std::remove_cv_t<std::remove_reference_t<T>>;
278277

279278
std::optional<TPlain> item_p_;
280279

0 commit comments

Comments
 (0)