LEMUR Packages: ompl_lemur or_lemur pr_bgl prpy_lemur
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Groups Pages
pair_index_map.h
Go to the documentation of this file.
1 
10 namespace pr_bgl
11 {
12 
19 template <class Each, class EachIndexMap>
21 {
22 public:
23  typedef std::pair<Each,Each> key_type;
24  typedef size_t value_type;
25  typedef size_t reference;
26  typedef boost::readable_property_map_tag category;
27  const EachIndexMap & eachmap;
28  const size_t ncols;
29  pair_index_map(const EachIndexMap & in_eachmap, const size_t in_ncols) :
30  eachmap(in_eachmap), ncols(in_ncols) {}
31 };
32 
33 template <class Each, class EachIndexMap>
34 inline size_t
35 get(const pair_index_map<Each,EachIndexMap>& map, const std::pair<Each,Each> & k)
36 {
37  size_t i = get(map.eachmap, k.first);
38  size_t j = get(map.eachmap, k.second);
39  return i*map.ncols + j;
40 }
41 
42 } // namespace pr_bgl
Convert a master index to a row-major-order matrix index pair.
Definition: pair_index_map.h:20