Migration from boost::string_ref and boost::string_view

In this lesson, we'll learn about the classes from which std::string_view was developed.

As with most of the new types in C++17 string_view is also inspired by boost libraries. Marshall Clow implemented boost::string_ref in the version 1.53 (February 2012) and then it evolved into boost::string_view (added into the version 1.61 - May 2016).

The main difference between boost::string_ref and boost::string_view is constexpr support.

boost::string_view implements the same functionality as std::string_view and also adds a few new functions:

  • starts_with
  • ends_with

See the full header file here. You can also find the whole Boost utility library here.

The link to the discussion about string_ref being deprecated: “string_view versus string_ref ”.


The lessons ahead contain examples of string_view interacting with other properties of strings.

Get hands-on with 1200+ tech skills courses.