This file is indexed.

/usr/include/measurement_kit/common/var.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
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
// 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_VAR_HPP
#define MEASUREMENT_KIT_COMMON_VAR_HPP

#include <memory>
#include <stdexcept>

namespace mk {

template <typename T> class Var {
  public:
    template <typename Deleter>
    Var(typename std::add_pointer<T>::type p, Deleter &&deleter)
        : ptr_{std::shared_ptr<T>{p, deleter}} {}

    Var(typename std::add_pointer<T>::type p) : ptr_{std::shared_ptr<T>{p}} {}

    Var(std::shared_ptr<T> &&ptr) : ptr_{ptr} {}

    Var() {}

    long use_count() const noexcept { return ptr_.use_count(); }

    operator bool() const { return static_cast<bool>(ptr_); }

    void reset(typename std::add_pointer<T>::type p = nullptr) {
        ptr_.reset(p);
    }

    bool operator==(std::nullptr_t x) const noexcept {
        return ptr_ == x;
    }

    template <typename Deleter>
    void reset(typename std::add_pointer<T>::type p, Deleter &&deleter) {
        ptr_.reset(p, deleter);
    }

    typename std::add_pointer<T>::type get() const { return operator->(); }

    typename std::add_pointer<T>::type operator->() const {
        if (ptr_.get() == nullptr) {
            throw std::runtime_error("null pointer");
        }
        return ptr_.operator->();
    }

    typename std::add_lvalue_reference<T>::type operator*() const {
        if (ptr_.get() == nullptr) {
            throw std::runtime_error("null pointer");
        }
        return ptr_.operator*();
    }

    template <typename R> Var<R> as() const {
        return std::dynamic_pointer_cast<R>(ptr_);
    }

    template <typename... A> static Var<T> make(A &&... a) {
        return std::make_shared<T>(std::forward<A>(a)...);
    }

  private:
    std::shared_ptr<T> ptr_;
};

} // namespace mk
#endif