Both string_ref in boost and string_span in GSL doesn't define constructor that takes a pair of iterator. What is the reason of this decision ?
Usually it's not a big deal, I can just create string_ref like this :
boost::string_ref s(start, std::distance(start, finish));
template<typename Type, typename Iterator>
void func(const Iterator& begin, const Iterator& end)
Type s(begin, end);
//do stuff with s
func<boost::string_ref>(start, finish) //compile error
Looks like I make a mistake.
gsl::string_span do have a constructor that takes begin and end iterator. So, there is nothing problematic with creating string_view from iterator pairs and the lack of it in
boost::string_ref is probably just an oversight.
For my case, I end up inheriting from
boost::string_ref and add the constructor myself.