命名空间
变体
操作

std::ranges::drop_view<V>::end

来自 cppreference.cn
< cpp‎ | ranges‎ | drop_view
 
 
范围库 (Ranges library)
范围适配器 (Range adaptors)
 
 
constexpr auto end() requires (!/*simple-view*/<V>);
(1) (C++20 起)
constexpr auto end() const requires ranges::range<const V>;
(2) (C++20 起)

返回表示 drop_view 结尾的哨兵或迭代器。

[编辑] 返回值

ranges::end(base_).

[编辑] 示例

#include <algorithm>
#include <iostream>
#include <iterator>
#include <ranges>
 
int main()
{
    namespace ranges = std::ranges;
    constexpr char url[]{"https://cppreference.cn"};
 
    const auto p = std::distance(ranges::begin(url), ranges::find(url, '/'));
    auto site = ranges::drop_view{url, p + 2}; // drop the prefix "https://"
 
    for (auto it = site.begin(); it != site.end(); ++it)
        std::cout << *it;
    std::cout << '\n';
}

输出

cppreference.cn

[编辑] 参阅

返回指向起始的迭代器
(public member function) [编辑]
返回指向范围开头的迭代器
(customization point object)[编辑]
返回指示范围末尾的哨兵
(customization point object)[编辑]