C++ Logo


Advanced search

Subject: [std-proposals] Add first and last to the std::string_view
From: 康桓瑋 (hewillk_at_[hidden])
Date: 2021-01-22 01:03:02

C++20 introduced the *std::span* which makes it easier to deal
with continuous rage. Especially the subview facilities: *first*, *last*
and *subspan*. I wonder if we can add *first* and *last* function to
*std::string_view*, then we can generate the *substr* more intuitively
and less fallible:

static_assert("hello world"sv.first(5) == "hello");

Thanks for your reply!

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups