/usr/include/boost/property_map/function_property_map.hpp is in libboost1.55-dev 1.55.0+dfsg-3.
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 | //
//=======================================================================
// Author: Philipp Moeller
//
// Copyright 2012, Philipp Moeller
//
// Distributed under 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)
//=======================================================================
//
#ifndef BOOST_PROPERTY_MAP_FUNCTION_PROPERTY_MAP_HPP
#define BOOST_PROPERTY_MAP_FUNCTION_PROPERTY_MAP_HPP
#include <boost/config.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/type_traits.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <utility>
namespace boost {
template<typename Func, typename Key, typename Ret = typename boost::result_of<const Func(const Key&)>::type>
class function_property_map: public put_get_helper<Ret, function_property_map<Func, Key, Ret> > {
public:
typedef Key key_type;
typedef Ret reference;
typedef typename boost::remove_cv<typename boost::remove_reference<Ret>::type>::type value_type;
typedef typename boost::mpl::if_<
boost::mpl::and_<
boost::is_reference<Ret>,
boost::mpl::not_<boost::is_const<Ret> >
>,
boost::lvalue_property_map_tag,
boost::readable_property_map_tag>::type
category;
function_property_map(Func f = Func()) : f(f) {}
reference operator[](const Key& k) const {
return f(k);
}
private:
Func f;
};
template<typename Key, typename Func>
function_property_map<Func, Key>
make_function_property_map(const Func& f) {
return function_property_map<Func, Key>(f);
}
template<typename Key, typename Ret, typename Func>
function_property_map<Func, Key, Ret>
make_function_property_map(const Func& f) {
return function_property_map<Func, Key, Ret>(f);
}
} // boost
#endif /* BOOST_PROPERTY_MAP_FUNCTION_PROPERTY_MAP_HPP */
|