Binary::range_t Binary::off_ranges() const {

  const auto it_min = std::min_element(
      std::begin(segments_), std::end(segments_),
      [] (const SegmentCommand* lhs, const SegmentCommand* rhs) {
        if (lhs->file_offset() == 0 || rhs->file_offset() == 0) {
          return true;
        }
        return lhs->file_offset() < rhs->file_offset();
      });


  const auto it_max = std::min_element(
      std::begin(segments_), std::end(segments_),
      [] (const SegmentCommand* lhs, const SegmentCommand* rhs) {
        return (lhs->file_offset() + lhs->file_size()) > (rhs->file_offset() + rhs->file_size());
      });

  return {(*it_min)->file_offset(), (*it_max)->file_offset() + (*it_max)->file_size()};
}
Binary::range_t Binary::off_ranges() const {

  const auto it_min = std::min_element(
      std::begin(segments_), std::end(segments_),
      [] (const SegmentCommand* lhs, const SegmentCommand* rhs) {
        if (lhs->file_offset() == 0 || rhs->file_offset() == 0) {
          return true;
        }
        return lhs->file_offset() < rhs->file_offset();
      });


  const auto it_max = std::min_element(
      std::begin(segments_), std::end(segments_),
      [] (const SegmentCommand* lhs, const SegmentCommand* rhs) {
        return (lhs->file_offset() + lhs->file_size()) > (rhs->file_offset() + rhs->file_size());
      });

  return {(*it_min)->file_offset(), (*it_max)->file_offset() + (*it_max)->file_size()};
}