Skip to content

Commit

Permalink
fix rene suggestion.
Browse files Browse the repository at this point in the history
  • Loading branch information
smehringer committed Oct 9, 2020
1 parent 3a5605c commit 1242347
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions include/seqan3/io/alignment_file/format_sam_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,17 @@ inline void format_sam_base::read_field(stream_view_type && stream_view, target_

// Note that we need to cache the begin iterator since the stream_view is an input range that may be consuming
// and in that case might read `past-the-end` on a second call of std::ranges::begin.
auto it = std::ranges::begin(stream_view);
char c = *it;
// Write to target if field does not represent an empty string, denoted as single '*' character.
if (!(++it == std::ranges::end(stream_view) && c == '*'))
if (auto it = std::ranges::begin(stream_view); it != std::ranges::end(stream_view))
{
target.push_back(seqan3::assign_char_to(c, target_range_value_t{}));
std::ranges::copy(std::ranges::subrange<begin_iterator_t, end_iterator_t>{it, std::ranges::end(stream_view)}
| views::char_to<target_range_value_t>,
std::cpp20::back_inserter(target));
char c = *it;
// Write to target if field does not represent an empty string, denoted as single '*' character.
if (!(++it == std::ranges::end(stream_view) && c == '*'))
{
target.push_back(seqan3::assign_char_to(c, target_range_value_t{}));
std::ranges::copy(std::ranges::subrange<begin_iterator_t, end_iterator_t>{it, std::ranges::end(stream_view)}
| views::char_to<target_range_value_t>,
std::cpp20::back_inserter(target));
}
}
}

Expand Down

0 comments on commit 1242347

Please sign in to comment.