@brief Constructs a sub basic_str_view object from `pos` by `n` size. @warning Throws an fkyaml::out_of_range exception if the given `pos` is bigger than the length. @param pos The offset of the beginning position. @param n The number of elements to the end of a new sub basic_str_view object. @return A newly created sub basic_str_view object.
| 2450 | /// @param n The number of elements to the end of a new sub basic_str_view object. |
| 2451 | /// @return A newly created sub basic_str_view object. |
| 2452 | basic_str_view substr(size_type pos = 0, size_type n = npos) const { |
| 2453 | if FK_YAML_UNLIKELY (pos > m_len) { |
| 2454 | throw fkyaml::out_of_range(static_cast<int>(pos)); |
| 2455 | } |
| 2456 | const size_type rlen = std::min(n, m_len - pos); |
| 2457 | return basic_str_view(mp_str + pos, rlen); |
| 2458 | } |
| 2459 | |
| 2460 | /// @brief Compares the referenced character sequence values with the given basic_str_view object. |
| 2461 | /// @param sv The basic_str_view object to compare with. |
no test coverage detected