/usr/include/measurement_kit/common/has_global_factory.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 | // 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_HAS_GLOBAL_FACTORY_HPP
#define MEASUREMENT_KIT_COMMON_HAS_GLOBAL_FACTORY_HPP
#include <measurement_kit/common/locked.hpp>
#include <measurement_kit/common/var.hpp>
namespace mk {
template <typename T> class HasGlobalFactory {
public:
template <typename... A> static Var<T> global(A &&... a) {
return locked_global([&]() {
static Var<T> singleton;
if (!singleton) {
singleton = Var<T>::make(std::forward<A>(a)...);
}
return singleton;
});
}
};
} // namespace mk
#endif
|