| 699 | |
| 700 | template<class R> |
| 701 | constexpr decltype(auto) unpack_range(R && r) |
| 702 | { |
| 703 | using T = detail::remove_cv_ref_t<R>; |
| 704 | if constexpr (forward_range_v<T>) { |
| 705 | auto unpacked = |
| 706 | boost::parser::detail::text::unpack_iterator_and_sentinel(detail::begin(r), detail::end(r)); |
| 707 | if constexpr (is_bounded_array_v<T>) { |
| 708 | constexpr auto n = std::extent_v<T>; |
| 709 | if (n && !r[n - 1]) |
| 710 | --unpacked.last; |
| 711 | return BOOST_PARSER_DETAIL_TEXT_SUBRANGE(unpacked.first, unpacked.last); |
| 712 | } else if constexpr ( |
| 713 | !std::is_same_v<decltype(unpacked.first), iterator_t<R>> || |
| 714 | !std::is_same_v<decltype(unpacked.last), sentinel_t<R>>) { |
| 715 | return unpacking_view(std::forward<R>(r)); |
| 716 | } else { |
| 717 | return std::forward<R>(r); |
| 718 | } |
| 719 | } else { |
| 720 | return std::forward<R>(r); |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | template<class R> |
| 725 | using unpacked_range = decltype(detail::unpack_range(std::declval<R>())); |
no test coverage detected