This file is indexed.

/usr/include/osl/misc/fixedCapacityVector.h is in libosl-dev 0.6.0-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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/* fixedCapacityVector.h
 */
#ifndef OSL_FIXED_CAPACITY_VECTOR_H
#define OSL_FIXED_CAPACITY_VECTOR_H

#include "osl/misc/carray.h"
#include "osl/misc/cstdint.h"
#include "osl/misc/construct.h"
#include <algorithm>
#include <cstddef>
#include <cassert>

#if (__GNUC__ >= 4 && __GNUC_MINOR__ >=4)
#  pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif

namespace osl
{
  namespace misc
  {
  template <typename T>
  class FixedCapacityVectorPushBack
  {
    T *ptr;
    T **vPtr;
#if ! (defined NDEBUG && defined MINIMAL)
    T *limit;
#endif
  public:
    FixedCapacityVectorPushBack(T** vPtr_, T* limit_)
      : ptr(*vPtr_), vPtr(vPtr_)
#if ! (defined NDEBUG && defined MINIMAL)
      ,limit(limit_)
#endif
    {
    }
    ~FixedCapacityVectorPushBack()
    {
      assert( *vPtr == ptr );
      *vPtr = ptr;
    }
    void push_back(const T& e) 
    {
      assert(ptr < limit);
      assert( *vPtr == ptr );
      if(misc::detail::BitCopyTraits<T>::value)
	*ptr++ = e;
      else
	construct(ptr++,e);
#ifndef NDEBUG
      (*vPtr)++;
#endif
    }
  };
  template <typename T, size_t Capacity>
  class FixedCapacityVector
  {
  protected:
    struct Array : public CArray<T, Capacity> {}
#ifdef __GNUC__
    __attribute__((__may_alias__))
#endif
      ;
    typedef Array array_t;
    T* ptr;
    CArray<int64_t, (sizeof(T[Capacity])+sizeof(int64_t)-1)/sizeof(int64_t)> relements;
  private:
    const array_t &elements() const{
      return *reinterpret_cast<const array_t*>(&relements);
    }
    array_t &elements(){
      return *reinterpret_cast<array_t*>(&relements);
    }
  public:
    typedef typename array_t::value_type value_type;
    typedef typename array_t::iterator iterator;
    typedef typename array_t::const_iterator const_iterator;
    
    FixedCapacityVector() : ptr(&(elements()[0])) {}
    explicit FixedCapacityVector(size_t size) : ptr(&(elements()[0])) 
    {
      resize(size);
    }
    FixedCapacityVector(FixedCapacityVector const& rhs){
      ptr= &*begin()+rhs.size();
      std::uninitialized_copy(rhs.begin(),rhs.end(),begin());
    }
    template <class RangeIterator>
    FixedCapacityVector(const RangeIterator& first, const RangeIterator& last)
      : ptr(&(elements()[0]))
    {
      push_back(first, last);
    }
    ~FixedCapacityVector() 
    {
      destroy(begin(),end());
    }
    FixedCapacityVector& operator=(FixedCapacityVector const& rhs){
      if (this == &rhs)
	return *this;
      
      if(size()>rhs.size()){
	iterator it=std::copy(rhs.begin(),rhs.end(),begin());
	destroy(it,end());
      }
      else{
	iterator it=std::copy(&(rhs.elements()[0]),
			      &(rhs.elements()[0])+size(),begin());
	std::uninitialized_copy(&(rhs.elements()[0])+size(),
				&(rhs.elements()[0])+rhs.size(),it);
      }
      ptr= &*begin()+rhs.size();
      return *this;
    }

    T& operator[] (size_t i)
    {
      assert(i <= size());
      return elements()[i];
    }

    iterator begin() {  return &elements()[0]; }
    iterator end() { return static_cast<iterator>(ptr); }

    T& front() { return *begin(); }
    T& back() { return *(end() - 1); }

    void push_back(const T& e)
    {
      assert(size() < Capacity);
      construct(ptr,e);
      ++ptr;
    }
    template <class RangeIterator>
    void push_back(const RangeIterator& first, const RangeIterator& last);
    void pop_back() { 
      --ptr;
      destroy(ptr+1);
    }
    void clear() { 
      size_t s=size();
      ptr= &(elements()[0]);
      // 該当する部分のdestructorを呼ぶ
      destroy(begin(),begin()+(int)s);
    }
    void resize(size_t new_length)
    {
      while (size() < new_length)
	push_back(T());
      if (new_length < size()) {
	destroy(begin()+(int)new_length,end());
	ptr= &(elements()[new_length]);
      }
    }

    void erase(const T& e)
    {
      const iterator new_end = std::remove(begin(), end(), e);
      ptr= &*new_end;
      destroy(new_end,end());
    }

    /** 重複する要素を取り除く */
    void unique()
    {
      std::sort(begin(),end());
      iterator last = std::unique(begin(), end());
      ptr = &*last;
      destroy(last,end());
    }

    size_t size() const { return ptr-&*begin(); }
    bool empty() const { return ptr==&*begin(); }
    size_t capacity() const { return Capacity; }

    T const& operator[] (size_t i) const
    {
      assert(i < size());
      return elements()[i];
    }
    const_iterator begin() const { return &elements()[0]; }
    const_iterator end()   const { return ptr; }

    const T& front() const { return *begin(); }
    const T& back() const { return *(end() - 1); }
    
    bool isMember(const T& e, const_iterator first, const_iterator last) const
    {
      return std::find(first, last, e) != last;
    }
    bool isMember(const T& e) const
    {
      return isMember(e, begin(), end());
    }
    FixedCapacityVectorPushBack<T> pushBackHelper() 
    {
      return FixedCapacityVectorPushBack<T>
	(&ptr, &*begin()+Capacity);
    }
  };
    template <typename T, size_t C> inline
    bool operator==(const FixedCapacityVector<T,C>& l, const FixedCapacityVector<T,C>& r) 
    {
      return l.size() == r.size() && std::equal(l.begin(), l.end(), r.begin());
    }
    template <typename T, size_t C> inline
    bool operator<(const FixedCapacityVector<T,C>& l, const FixedCapacityVector<T,C>& r) 
    {
      return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
    }
  } // namespace misc
  using misc::FixedCapacityVector;
  using misc::FixedCapacityVectorPushBack;
} // namespace osl

template <typename T, size_t Capacity>
template <class RangeIterator>
void osl::misc::FixedCapacityVector<T,Capacity>::push_back(const RangeIterator& first, const RangeIterator& last)
{
  iterator insert_point = end();
  std::uninitialized_copy(first, last, insert_point);
  ptr += last-first;
  assert(size() <= Capacity);
}


#endif /* OSL_FIXED_CAPACITY_VECTOR_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: