Non-pointer-operand error when dereferencing an iterator into a temporary range
问题 Using auto empty_line = [](auto& str){ return str.size() == 0; }; we can do this: auto line_range_with_first_non_empty = ranges::view::drop_while(ranges::getlines(std::cin),empty_line); auto input1 = std::stoi(*line_range_with_first_non_empty.begin()); and we can also do this: auto line_range2 = ranges::getlines(std::cin); auto iter2 = ranges::find_if_not(line_range2,empty_line); auto input2 = std::stoi(*iter2); Unfortunately, when I try to shorten version above into: auto iter3 = ranges: