std::ranges::split_view
These deduction guides are provided for split_view
to allow deduction from a range and a delimiter.
#include <ranges> #include <string_view> #include <type_traits> using std::operator""sv; int main() { std::ranges::split_view w1{"a::b::c"sv, "::"sv}; static_assert(std::is_same_v< decltype(w1), std::ranges::split_view<std::string_view, std::string_view>>); std::ranges::split_view w2{"x,y,z"sv, ','}; static_assert(std::is_same_v< decltype(w2), std::ranges::split_view<std::string_view, std::ranges::single_view<char>>>); }
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/split_view/deduction_guides