[PATCH] D79740: Align mapped_iterator::reference type with mapped_iterator::operator*() return value.

Ivan Kelarev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 16:12:59 PDT 2020


ikelarev added a comment.

David, thank you for your comments! Actually I didn't try to change pointer type and difference type of the iterator, I left them exactly equal to default values of iterator_adaptor_base. I just wanted to fix reference type of the iterator. I added another example (without map_range/reverse) to make clearer what I mean. Shouldn't operator* return exactly iterator's reference type here?

  std::vector<int> V;
  auto It = map_iterator(V.begin(), [](int) { return 0; });
  decltype(It)::reference R = *It; // error C2440: 'initializing': cannot convert 
                                   // from 'FuncReturnTy' to 'int &' with FuncReturnTy=int


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79740/new/

https://reviews.llvm.org/D79740





More information about the llvm-commits mailing list