This file is indexed.

/usr/include/range/v3/utility/invoke.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
219
220
221
222
223
224
/// \file
// Range v3 library
//
//  Copyright Eric Niebler 2013-present
//  Copyright Casey Carter 2016
//
//  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_UTILITY_INVOKE_HPP
#define RANGES_V3_UTILITY_INVOKE_HPP

#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
#include <meta/meta.hpp>
#include <range/v3/detail/config.hpp>
#include <range/v3/utility/concepts.hpp>
#include <range/v3/utility/static_const.hpp>

RANGES_DIAGNOSTIC_PUSH
RANGES_DIAGNOSTIC_IGNORE_PRAGMAS
RANGES_DIAGNOSTIC_IGNORE_CXX17_COMPAT

namespace ranges
{
    inline namespace v3
    {
        /// \addtogroup group-utility
        /// @{
        template<typename T>
        struct is_reference_wrapper
          : meta::if_<
                std::is_same<uncvref_t<T>, T>,
                std::false_type,
                is_reference_wrapper<uncvref_t<T>>>
        {};

        template<typename T>
        struct is_reference_wrapper<reference_wrapper<T>>
          : std::true_type
        {};

        template<typename T>
        struct is_reference_wrapper<std::reference_wrapper<T>>
          : std::true_type
        {};

        template<typename T>
        using is_reference_wrapper_t = meta::_t<is_reference_wrapper<T>>;

        struct invoke_fn
        {
        private:
            template<typename MemberFunctionPtr, typename First, typename... Rest>
            static constexpr auto invoke_member_fn(
                std::true_type, detail::any, MemberFunctionPtr fn, First && first, Rest &&... rest)
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                (static_cast<First&&>(first).*fn)(static_cast<Rest&&>(rest)...)
            )
            template<typename MemberFunctionPtr, typename First, typename... Rest>
            static constexpr auto invoke_member_fn(
                std::false_type, std::true_type, MemberFunctionPtr fn, First && first, Rest &&... rest)
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                (static_cast<First&&>(first).get().*fn)(static_cast<Rest&&>(rest)...)
            )
            template<typename MemberFunctionPtr, typename First, typename... Rest>
            static constexpr auto invoke_member_fn(
                std::false_type, std::false_type, MemberFunctionPtr fn, First && first, Rest &&... rest)
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                ((*static_cast<First&&>(first)).*fn)(static_cast<Rest&&>(rest)...)
            )

            template<typename MemberDataPtr, typename First>
            static constexpr auto invoke_member_data(
                std::true_type, detail::any, MemberDataPtr ptr, First && first)
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                static_cast<First&&>(first).*ptr
            )
            template<typename MemberDataPtr, typename First>
            static constexpr auto invoke_member_data(
                std::false_type, std::true_type, MemberDataPtr ptr, First && first)
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                static_cast<First&&>(first).get().*ptr
            )
            template<typename MemberDataPtr, typename First>
            static constexpr auto invoke_member_data(
                std::false_type, std::false_type, MemberDataPtr ptr, First && first)
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                (*static_cast<First&&>(first)).*ptr
            )
        public:
            template<typename F, typename Obj, typename First, typename... Rest,
                meta::if_c<detail::is_function<F>::value, int> = 0>
            constexpr auto operator()(F Obj::*ptr, First && first, Rest &&... rest) const
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                invoke_member_fn(std::is_base_of<Obj, detail::decay_t<First>>{},
                    is_reference_wrapper_t<detail::decay_t<First>>{},
                    ptr, static_cast<First&&>(first), static_cast<Rest&&>(rest)...)
            )
            template<typename Data, typename Obj, typename First,
                meta::if_c<!detail::is_function<Data>::value, int> = 0>
            constexpr auto operator()(Data Obj::*ptr, First && first) const
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                invoke_member_data(std::is_base_of<Obj, detail::decay_t<First>>{},
                    is_reference_wrapper_t<detail::decay_t<First>>{},
                    ptr, static_cast<First&&>(first))
            )
            template<typename F, typename... Args,
                meta::if_c<!std::is_member_pointer<uncvref_t<F>>::value, int> = 0>
            constexpr auto operator()(F && fn, Args &&... args) const
            RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
            (
                static_cast<F&&>(fn)(static_cast<Args&&>(args)...)
            )
        };
        RANGES_INLINE_VARIABLE(invoke_fn, invoke)

        /// \cond
        namespace detail
        {
            template<typename T>
            struct reference_wrapper_
            {
                T *t_ = nullptr;
                constexpr reference_wrapper_() = default;
                constexpr reference_wrapper_(T &t) noexcept
                  : t_(std::addressof(t))
                {}
                constexpr reference_wrapper_(T &&) = delete;
                constexpr T &get() const noexcept
                {
                    return *t_;
                }
            };
            template<typename T>
            struct reference_wrapper_<T &> : reference_wrapper_<T>
            {
                using reference_wrapper_<T>::reference_wrapper_;
            };
            template<typename T>
            struct reference_wrapper_<T &&>
            {
                T *t_ = nullptr;
                constexpr reference_wrapper_() = default;
                constexpr reference_wrapper_(T &&t) noexcept
                  : t_(std::addressof(t))
                {}
                constexpr T &&get() const noexcept
                {
                    return static_cast<T &&>(*t_);
                }
            };
        }
        /// \endcond

        // Can be used to store rvalue references in addition to lvalue references.
        // Also, see: https://cplusplus.github.io/LWG/lwg-active.html#2993
        template<typename T>
        struct reference_wrapper : private detail::reference_wrapper_<T>
        {
        private:
            using base_ = detail::reference_wrapper_<T>;
        public:
            using type = meta::_t<std::remove_reference<T>>;
            using reference = meta::if_<std::is_reference<T>, T, T &>;

            constexpr reference_wrapper() = default;
            template<typename U,
                CONCEPT_REQUIRES_(Constructible<base_, U>() &&
                    !Same<uncvref_t<U>, reference_wrapper>())>
            constexpr reference_wrapper(U &&u)
                noexcept(std::is_nothrow_constructible<base_, U>::value)
              : detail::reference_wrapper_<T>{static_cast<U &&>(u)}
            {}
            constexpr reference get() const noexcept
            {
                return this->base_::get();
            }
            constexpr operator reference() const noexcept
            {
                return get();
            }
            CONCEPT_REQUIRES(!std::is_rvalue_reference<T>::value)
            operator std::reference_wrapper<type> () const noexcept
            {
                return {get()};
            }
            template<typename ...Args>
            constexpr auto operator()(Args &&...args) const
            RANGES_DECLTYPE_NOEXCEPT(
                invoke(std::declval<reference>(), std::declval<Args>()...))
            {
                return invoke(get(), static_cast<Args&&>(args)...);
            }
        };

        template<typename Sig, typename Enable /*= void*/>
        struct result_of {};
        template<typename Fun, typename...Args>
        struct result_of<Fun(Args...), meta::void_<
            decltype(invoke(std::declval<Fun>(), std::declval<Args>()...))>>
        {
            using type = decltype(invoke(std::declval<Fun>(), std::declval<Args>()...));
        };
    } // namespace v3
} // namespace ranges

RANGES_DIAGNOSTIC_POP

#endif // RANGES_V3_UTILITY_INVOKE_HPP