This file is indexed.

/usr/include/polymake/vector is in libpolymake-dev-common 3.2r2-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
 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
/* Copyright (c) 1997-2018
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
   http://www.polymake.org

   This program is free software; 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 2, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
--------------------------------------------------------------------------------
*/

#ifndef POLYMAKE_VECTOR_
#define POLYMAKE_VECTOR_

#include <vector>
#include <cstring>
#include "polymake/internal/operations.h"
#include "polymake/internal/modified_containers.h"

namespace pm {

template <typename Value, typename Alloc>
struct spec_object_traits< std::vector<Value,Alloc> >
   : spec_object_traits<is_container> { };

template <typename Value, typename Alloc> inline
void relocate(std::vector<Value,Alloc>* from, std::vector<Value,Alloc>* to)
{
   using vector_t=std::vector<Value,Alloc>;
   new(to) vector_t(std::move(*from));
   from->~vector_t();
}

#if defined(_LIBCPP_VERSION)

template <typename Iterator>
struct iterator_cross_const_helper<std::__bit_iterator<Iterator,true>, true>{
   typedef std::__bit_iterator<Iterator, false> iterator;
   typedef std::__bit_iterator<Iterator, true> const_iterator;
};
template <typename Iterator>
struct iterator_cross_const_helper<std::__bit_iterator<Iterator,false>, true>{
   typedef std::__bit_iterator<Iterator, false> iterator;
   typedef std::__bit_iterator<Iterator, true> const_iterator;
};

#endif

template <typename IteratorRef, typename Container>
struct random_iterator_assoc_adapter {
   typedef IteratorRef argument_type;
   typedef iterator_traits<typename deref<IteratorRef>::type> it_traits;
   typedef std::pair<typename it_traits::difference_type, typename it_traits::reference> result_type;

   random_iterator_assoc_adapter() : c(0) { }

   random_iterator_assoc_adapter(const Container& c_arg)
      : c(&c_arg) { }

   template <typename IteratorRef2>
   random_iterator_assoc_adapter(const random_iterator_assoc_adapter<IteratorRef2,Container>& op)
      : c(op.c) { }

   result_type operator() (argument_type it) const
   {
      return result_type(it-c->begin(), *it);
   }

protected:
   const Container* c;
   template <typename, typename> friend struct random_iterator_assoc_adapter;
};

template <typename Container>
struct Build_random_iterator_assoc_adapter { };

template <typename Container, typename Iterator, typename ElemRef>
struct unary_op_builder<Build_random_iterator_assoc_adapter<Container>, Iterator, ElemRef> {
   typedef random_iterator_assoc_adapter<const Iterator&, Container> operation;
   static operation create(const Build_random_iterator_assoc_adapter<Container>& c)
   {
      return reinterpret_cast<const Container&>(c);
   }
   static const operation& create(const operation& op) { return op; }

   typedef typename std::conditional<attrib<ElemRef>::is_const,
                                     const random_iterator_assoc_adapter<typename attrib<ElemRef>::minus_const, Container>, operation>::type
      alt_operation;
   static operation create(alt_operation& op) { return operation(op); }
};

template <typename Value>
class vector_as_property_map
   : public modified_container_impl< vector_as_property_map<Value>,
                                     mlist< ContainerTag< std::vector<Value> >,
                                            OperationTag< Build_random_iterator_assoc_adapter< std::vector<Value> > > > > {
   typedef modified_container_impl<vector_as_property_map> base_t;
public:
   typedef typename base_t::container vec_type;
   typedef int key_type;
   typedef Value mapped_type;
   typedef typename vec_type::reference reference;
   typedef typename vec_type::const_reference const_reference;

   vec_type& get_container() { return vec; }
   const vec_type& get_container() const { return vec; }
   const typename base_t::operation& get_operation() const
   {
      return reinterpret_cast<const typename base_t::operation&>(vec);
   }

   typedef pair<int, Value> value_type;

   explicit vector_as_property_map(size_t expected_size=0)
      : def_val()
   {
      if (expected_size) vec.reserve(expected_size);
   }

   reference operator() (size_t k)
   {
      if (k >= vec.size()) vec.resize(k+1, def_val);
      return vec[k];
   }

   const_reference operator() (size_t k) const
   {
      if (k < vec.size()) return vec[k];
      return def_val;
   }

   reference operator[] (size_t k) { return vec[k]; }
   const_reference operator[] (size_t k) const { return vec[k]; }

   pair<typename base_t::iterator, bool> insert(int k, typename function_argument<Value>::type v)
   {
      if ((size_t)k >= vec.size() || vec[k]==def_val) {
         (*this)(k)=v;
         return std::make_pair(typename base_t::iterator(vec.begin()+k), true);
      }
      return std::make_pair(typename base_t::iterator(vec.begin()+k), false);
   }

   void set_default_value(typename function_argument<Value>::type default_value)
   {
      def_val=default_value;
   }

   void clear() { vec.clear(); }
protected:
   vec_type vec;
   Value def_val;
};

} // end namespace pm

#endif // POLYMAKE_VECTOR_

// Local Variables:
// mode:C++
// c-basic-offset:3
// indent-tabs-mode:nil
// End: