/usr/include/range/v3/view/delimit.hpp is in librange-v3-dev 0.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /// \file
// Range v3 library
//
// Copyright Eric Niebler 2013-present
//
// Use, modification and distribution is subject to the
// Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//
#ifndef RANGES_V3_VIEW_DELIMIT_HPP
#define RANGES_V3_VIEW_DELIMIT_HPP
#include <meta/meta.hpp>
#include <range/v3/detail/satisfy_boost_range.hpp>
#include <range/v3/range_fwd.hpp>
#include <range/v3/range_concepts.hpp>
#include <range/v3/view_adaptor.hpp>
#include <range/v3/iterator_range.hpp>
#include <range/v3/utility/unreachable.hpp>
#include <range/v3/utility/iterator_concepts.hpp>
#include <range/v3/utility/functional.hpp>
#include <range/v3/utility/static_const.hpp>
#include <range/v3/view/view.hpp>
#include <range/v3/view/all.hpp>
namespace ranges
{
inline namespace v3
{
/// \addtogroup group-views
/// @{
template<typename Rng, typename Val>
struct delimit_view
: view_adaptor<delimit_view<Rng, Val>, Rng, is_finite<Rng>::value ? finite : unknown>
{
private:
friend range_access;
Val value_;
struct sentinel_adaptor : adaptor_base
{
sentinel_adaptor() = default;
sentinel_adaptor(Val value)
: value_(std::move(value))
{}
bool empty(iterator_t<Rng> it, sentinel_t<Rng> end) const
{
return it == end || *it == value_;
}
Val value_;
};
sentinel_adaptor end_adaptor() const
{
return {value_};
}
public:
delimit_view() = default;
delimit_view(Rng rng, Val value)
: delimit_view::view_adaptor{std::move(rng)}
, value_(std::move(value))
{}
};
namespace view
{
struct delimit_impl_fn
{
private:
friend view_access;
template<typename Val>
static auto bind(delimit_impl_fn delimit, Val value)
RANGES_DECLTYPE_AUTO_RETURN
(
make_pipeable(std::bind(delimit, std::placeholders::_1, std::move(value)))
)
public:
template<typename Rng, typename Val>
using Concept = meta::and_<
Range<Rng>,
EqualityComparable<Val, range_common_reference_t<Rng>>>;
template<typename Rng, typename Val,
CONCEPT_REQUIRES_(Concept<Rng, Val>())>
delimit_view<all_t<Rng>, Val>
operator()(Rng && rng, Val value) const
{
return {all(static_cast<Rng&&>(rng)), std::move(value)};
}
#ifndef RANGES_DOXYGEN_INVOKED
template<typename Rng, typename Val,
CONCEPT_REQUIRES_(!Concept<Rng, Val>())>
void
operator()(Rng &&, Val) const
{
CONCEPT_ASSERT_MSG(Range<Rng>(),
"Rng must model the Range concept");
CONCEPT_ASSERT_MSG(EqualityComparable<Val, range_common_reference_t<Rng>>(),
"The delimiting value type must be EqualityComparable to the "
"range's common reference type.");
}
#endif
};
struct delimit_fn : view<delimit_impl_fn>
{
using view<delimit_impl_fn>::operator();
template<typename I, typename Val,
CONCEPT_REQUIRES_(InputIterator<I>())>
delimit_view<iterator_range<I, unreachable>, Val>
operator()(I begin, Val value) const
{
return {{std::move(begin), {}}, std::move(value)};
}
};
/// \relates delimit_fn
/// \ingroup group-views
RANGES_INLINE_VARIABLE(delimit_fn, delimit)
}
/// @}
}
}
RANGES_SATISFY_BOOST_RANGE(::ranges::v3::delimit_view)
#endif
|