This file is indexed.

/usr/include/measurement_kit/common/delegate.hpp is in libmeasurement-kit-dev 0.7.1-2build1.

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
// Part of measurement-kit <https://measurement-kit.github.io/>.
// Measurement-kit is free software. See AUTHORS and LICENSE for more
// information on the copying conditions.
#ifndef MEASUREMENT_KIT_COMMON_DELEGATE_HPP
#define MEASUREMENT_KIT_COMMON_DELEGATE_HPP

#include <cstddef>
#include <functional>

namespace mk {

// Implementation note: this class could also have been written as a subclass
// of function but I, er, was not able to write it like so because I do not
// know enough about templates syntax, plus it's not totally clear to me what
// would be the proper way to wrap `swap` and `assign`.
template <typename T> class Delegate_ {
  public:
    Delegate_() {}
    template <typename F> Delegate_(F f) : func(f) {}
    Delegate_(std::function<T> f) : func(f) {}

    ~Delegate_() {}

    void operator=(std::function<T> f) { func = f; }
    template <typename F> void operator=(F f) { func = f; }
    void operator=(std::nullptr_t f) { func = f; }

    // not implementing swap and assign

    operator bool() { return static_cast<bool>(func); }

    template <typename... Args> void operator()(Args &&... args) {
        // Make sure the original closure is not destroyed before end of scope
        auto orig = this->func;
        orig(std::forward<Args>(args)...);
    }

  private:
    std::function<T> func;
};

template <typename... T> using Delegate = Delegate_<void(T...)>;

} // namespace
#endif