This file is indexed.

/usr/include/range/v3/view/tokenize.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/// \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_TOKENIZE_HPP
#define RANGES_V3_VIEW_TOKENIZE_HPP

#include <regex>
#include <vector>
#include <utility>
#include <type_traits>
#include <initializer_list>
#include <range/v3/detail/satisfy_boost_range.hpp>
#include <range/v3/range_fwd.hpp>
#include <range/v3/view_interface.hpp>
#include <range/v3/begin_end.hpp>
#include <range/v3/range_concepts.hpp>
#include <range/v3/utility/functional.hpp>
#include <range/v3/utility/static_const.hpp>
#include <range/v3/view/all.hpp>

namespace ranges
{
    inline namespace v3
    {
        /// \addtogroup group-views
        /// @{
        template<typename Rng, typename Regex, typename SubMatchRange>
        struct tokenize_view
          : view_interface<
                tokenize_view<Rng, Regex, SubMatchRange>,
                is_finite<Rng>::value ? finite : range_cardinality<Rng>::value>
        {
        private:
            CONCEPT_ASSERT(BidirectionalView<Rng>() && BoundedRange<Rng>());
            CONCEPT_ASSERT(SemiRegular<Regex>());
            CONCEPT_ASSERT(SemiRegular<SubMatchRange>());

            Rng rng_;
            Regex rex_;
            SubMatchRange subs_;
            std::regex_constants::match_flag_type flags_;
        public:
            using iterator =
                std::regex_token_iterator<iterator_t<Rng>>;

            tokenize_view() = default;
            tokenize_view(Rng rng, Regex rex, SubMatchRange subs,
                std::regex_constants::match_flag_type flags)
              : rng_(std::move(rng))
              , rex_(std::move(rex))
              , subs_(std::move(subs))
              , flags_(flags)
            {}
            iterator begin()
            {
                return {ranges::begin(rng_), ranges::end(rng_), rex_, subs_, flags_};
            }
            CONCEPT_REQUIRES(Range<Rng const &>())
            iterator begin() const
            {
                return {ranges::begin(rng_), ranges::end(rng_), rex_, subs_, flags_};
            }
            iterator end() const
            {
                return {};
            }
            Rng & base()
            {
                return rng_;
            }
            Rng const & base() const
            {
                return rng_;
            }
        };

        namespace view
        {
            struct tokenizer_impl_fn
            {
                template<typename Rng, typename Regex>
                tokenize_view<all_t<Rng>, detail::decay_t<Regex>, int>
                operator()(Rng && rng, Regex && rex, int sub = 0,
                    std::regex_constants::match_flag_type flags =
                        std::regex_constants::match_default) const
                {
                    CONCEPT_ASSERT(BidirectionalRange<Rng>());
                    CONCEPT_ASSERT(BoundedRange<Rng>());
                    static_assert(std::is_same<range_value_type_t<Rng>,
                        typename detail::decay_t<Regex>::value_type>::value,
                        "The character range and the regex have different character types");
                    return {all(static_cast<Rng&&>(rng)), static_cast<Regex&&>(rex), sub,
                            flags};
                }

                template<typename Rng, typename Regex>
                tokenize_view<all_t<Rng>, detail::decay_t<Regex>, std::vector<int>>
                operator()(Rng && rng, Regex && rex, std::vector<int> subs,
                    std::regex_constants::match_flag_type flags =
                        std::regex_constants::match_default) const
                {
                    CONCEPT_ASSERT(BidirectionalRange<Rng>());
                    CONCEPT_ASSERT(BoundedRange<Rng>());
                    static_assert(std::is_same<range_value_type_t<Rng>,
                        typename detail::decay_t<Regex>::value_type>::value,
                        "The character range and the regex have different character types");
                    return {all(static_cast<Rng&&>(rng)), static_cast<Regex&&>(rex),
                            std::move(subs), flags};
                }

                template<typename Rng, typename Regex>
                tokenize_view<all_t<Rng>, detail::decay_t<Regex>, std::initializer_list<int>>
                operator()(Rng && rng, Regex && rex,
                    std::initializer_list<int> subs, std::regex_constants::match_flag_type flags =
                        std::regex_constants::match_default) const
                {
                    CONCEPT_ASSERT(BidirectionalRange<Rng>());
                    CONCEPT_ASSERT(BoundedRange<Rng>());
                    static_assert(std::is_same<range_value_type_t<Rng>,
                        typename detail::decay_t<Regex>::value_type>::value,
                        "The character range and the regex have different character types");
                    return {all(static_cast<Rng&&>(rng)), static_cast<Regex&&>(rex),
                            std::move(subs), flags};
                }

                template<typename Regex>
                auto operator()(Regex && rex, int sub = 0,
                    std::regex_constants::match_flag_type flags =
                        std::regex_constants::match_default) const ->
                    decltype(make_pipeable(std::bind(*this, std::placeholders::_1, bind_forward<Regex>(rex),
                        std::move(sub), std::move(flags))))
                {
                    return make_pipeable(std::bind(*this, std::placeholders::_1, bind_forward<Regex>(rex),
                        std::move(sub), std::move(flags)));
                }

                template<typename Regex>
                auto operator()(Regex && rex, std::vector<int> subs,
                    std::regex_constants::match_flag_type flags =
                        std::regex_constants::match_default) const ->
                    decltype(make_pipeable(std::bind(*this, std::placeholders::_1, bind_forward<Regex>(rex),
                        std::move(subs), std::move(flags))))
                {
                    return make_pipeable(std::bind(*this, std::placeholders::_1, bind_forward<Regex>(rex),
                        std::move(subs), std::move(flags)));
                }

                template<typename Regex>
                auto operator()(Regex && rex,
                    std::initializer_list<int> subs, std::regex_constants::match_flag_type flags =
                        std::regex_constants::match_default) const ->
                    decltype(make_pipeable(std::bind(*this, std::placeholders::_1, bind_forward<Regex>(rex),
                        std::move(subs), std::move(flags))))
                {
                    return make_pipeable(std::bind(*this, std::placeholders::_1, bind_forward<Regex>(rex),
                        std::move(subs), std::move(flags)));
                }
            };

            // Damn C++ and its imperfect forwarding of initializer_list.
            struct tokenize_fn : tokenizer_impl_fn
            {
            private:
                tokenizer_impl_fn const & base() const
                {
                    return *this;
                }

            public:
                template<typename ...Args>
                auto operator()(Args &&...args) const
                    -> decltype(base()(static_cast<Args&&>(args)...))
                {
                    return base()(static_cast<Args&&>(args)...);
                }

                template<typename Arg0, typename ...Args>
                auto operator()(Arg0 && arg0, std::initializer_list<int> subs,
                    Args &&...args) const
                    -> decltype(base()(static_cast<Arg0&&>(arg0), std::move(subs),
                                       static_cast<Args&&>(args)...))
                {
                    return base()(static_cast<Arg0&&>(arg0), std::move(subs),
                                  static_cast<Args&&>(args)...);
                }

                template<typename Arg0, typename Arg1, typename ...Args>
                auto operator()(Arg0 && arg0, Arg1 && arg1, std::initializer_list<int> subs,
                    Args &&...args) const
                    -> decltype(base()(static_cast<Arg0&&>(arg0), static_cast<Arg1&&>(arg1),
                                       std::move(subs), static_cast<Args&&>(args)...))
                {
                    return base()(static_cast<Arg0&&>(arg0), static_cast<Arg1&&>(arg1),
                                  std::move(subs), static_cast<Args&&>(args)...);
                }
            };

            /// \relates tokenize_fn
            /// \ingroup group-views
            RANGES_INLINE_VARIABLE(tokenize_fn, tokenize)
        }
        /// @}
    }
}

RANGES_SATISFY_BOOST_RANGE(::ranges::v3::tokenize_view)

#endif