/usr/include/CGAL/property_map.h is in libcgal-dev 4.2-5ubuntu1.
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 | // Copyright (c) 2008-2009 GeometryFactory and INRIA
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Andreas Fabri and Laurent Saboret
#ifndef CGAL_POINT_SET_PROPERTY_MAP_H
#define CGAL_POINT_SET_PROPERTY_MAP_H
#include <CGAL/value_type_traits.h>
#include <boost/version.hpp>
#if BOOST_VERSION >= 104000
#include <boost/property_map/property_map.hpp>
#else
#include <boost/property_map.hpp>
#endif
#include <boost/tuple/tuple.hpp>
#include <utility> // defines std::pair
namespace CGAL {
/// \ingroup PkgProperty_map
/// Property map that converts a `T*` pointer (or in general an iterator
/// over `T` elements) to the `T` object.
///
/// \cgalModels `LvaluePropertyMap`
template <typename T>
struct Dereference_property_map
: public boost::put_get_helper<T&, Dereference_property_map<T> >
{
typedef T* key_type; ///< typedef to 'T*'
typedef T value_type; ///< typedef to 'T'
typedef value_type& reference; ///< typedef to 'T&'
typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
/// Access a property map element.
///
/// @tparam Iter Type convertible to `key_type`.
template <class Iter>
reference operator[](Iter it) const { return reference(*it); }
};
/// Free function to create a `Dereference_property_map` property map.
///
/// \relates Dereference_property_map
template <class Iter> // Type convertible to `key_type`
Dereference_property_map<typename CGAL::value_type_traits<Iter>::type>
make_dereference_property_map(Iter)
{
// value_type_traits is a workaround as back_insert_iterator's `value_type` is void
return Dereference_property_map<typename CGAL::value_type_traits<Iter>::type>();
}
//=========================================================================
/// \ingroup PkgProperty_map
/// Property map that accesses the first item of a `std::pair`.
/// \tparam Pair Instance of `std::pair`.
/// \cgalModels `LvaluePropertyMap`
///
/// \sa `CGAL::Second_of_pair_property_map<Pair>`
template <typename Pair>
struct First_of_pair_property_map
: public boost::put_get_helper<typename Pair::first_type&,
First_of_pair_property_map<Pair> >
{
typedef Pair* key_type; ///< typedef to 'Pair*'
typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type`
typedef value_type& reference; ///< typedef to `value_type&`
typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag
/// Access a property map element.
///
/// @tparam Iter Type convertible to `key_type`.
template <class Iter>
reference operator[](Iter pair) const { return reference(pair->first); }
};
/// Free function to create a `First_of_pair_property_map` property map.
///
/// \relates First_of_pair_property_map
template <class Iter> // Type convertible to key_type
First_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>
make_first_of_pair_property_map(Iter)
{
// value_type_traits is a workaround as back_insert_iterator's value_type is void
return First_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>();
}
/// \ingroup PkgProperty_map
///
/// Property map that accesses the second item of a `std::pair`.
///
/// \tparam Pair Instance of `std::pair`.
///
/// \cgalModels `LvaluePropertyMap`
///
/// \sa `CGAL::First_of_pair_property_map<Pair>`
template <typename Pair>
struct Second_of_pair_property_map
: public boost::put_get_helper<typename Pair::second_type&,
Second_of_pair_property_map<Pair> >
{
typedef Pair* key_type; ///< typedef to 'Pair*'
typedef typename Pair::second_type value_type; ///< typedef to `Pair::second_type`
typedef value_type& reference; ///< typedef to `value_type&`
typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
/// Access a property map element.
///
/// @tparam Iter Type convertible to `key_type`.
template <class Iter>
reference operator[](Iter pair) const { return reference(pair->second); }
};
/// Free function to create a Second_of_pair_property_map property map.
///
/// \relates Second_of_pair_property_map
template <class Iter> // Type convertible to key_type
Second_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>
make_second_of_pair_property_map(Iter)
{
// value_type_traits is a workaround as back_insert_iterator's value_type is void
return Second_of_pair_property_map<typename CGAL::value_type_traits<Iter>::type>();
}
//=========================================================================
/// \ingroup PkgProperty_map
///
/// Property map that accesses the Nth item of a `boost::tuple`.
///
/// \tparam N Index of the item to access.
/// \tparam Tuple Instance of `boost::tuple`.
///
/// \cgalModels `LvaluePropertyMap`
template <int N, typename Tuple>
struct Nth_of_tuple_property_map
: public boost::put_get_helper<typename boost::tuples::element<N,Tuple>::type&,
Nth_of_tuple_property_map<N,Tuple> >
{
typedef Tuple* key_type; ///< typedef to 'Tuple*'
typedef typename boost::tuples::element<N,Tuple>::type value_type; ///< typedef to `boost::tuples::element<N,Tuple>::%type`
typedef value_type& reference; ///< typedef to `value_type&`
typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag`
/// Access a property map element.
///
/// @tparam Iter Type convertible to `key_type`.
template <class Iter>
reference operator[](Iter tuple) const { return (reference) tuple->template get<N>(); }
};
/// Free function to create a Nth_of_tuple_property_map property map.
///
/// \relates Nth_of_tuple_property_map
template <int N, class Iter> // Type convertible to key_type
Nth_of_tuple_property_map<N, typename CGAL::value_type_traits<Iter>::type>
make_nth_of_tuple_property_map(Iter)
{
// value_type_traits is a workaround as back_insert_iterator's `value_type` is void
return Nth_of_tuple_property_map<N, typename CGAL::value_type_traits<Iter>::type>();
}
} // namespace CGAL
#endif // CGAL_POINT_SET_PROPERTY_MAP_H
|