This file is indexed.

/usr/include/osl/misc/carray2d.h is in libosl-dev 0.6.0-3.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
/* carray2d.h
 */
#ifndef OSL_CARRAY2D_H
#define OSL_CARRAY2D_H
#include "osl/player.h"
#include <algorithm>
#include <cstddef>
#include <cassert>

namespace osl
{
  namespace misc
  {
  template <typename T, size_t Capacity2>
  struct CArray2dProxy
  {
    T* a;
    explicit CArray2dProxy(T *ia) : a(ia)
    {
    }
    T& operator[](size_t j) const
    {
      assert(j < Capacity2);
      return a[j];
    }
    T& operator[] (Player p) const
    {
      return operator[](playerToIndex(p));
    }
  };
  template <typename T, typename T2, size_t C>
  inline bool operator==(const CArray2dProxy<T,C>& l, const CArray2dProxy<T2,C>& r)
  {
    return std::equal(l.a, l.a+C, r.a);
  }
  /**
   * CArray の2次元版
   *
   * [][] でアクセスすると普通の2次元配列とは生成されるコードがちょっと違う
   * (see junk/multi_array.cc)
   * operator()(i,j) ならもちろん全く同じ
   */
  template <typename T, size_t Capacity1, size_t Capacity2>
  class CArray2d
  {
  public:
    /** {} による初期化を許すために public にしておく */
    T elements[Capacity1][Capacity2];
  public:
    typedef CArray2d<T,Capacity1,Capacity2> array_t;
    typedef CArray2dProxy<T,Capacity2> proxy_t;
    typedef CArray2dProxy<const T,Capacity2> const_proxy_t;
    
    const proxy_t operator[] (size_t i) 
    {
      assert(i < Capacity1);
      return proxy_t(elements[i]);
    }
    T& operator()(size_t i, size_t j)
    {
      assert(i < Capacity1);
      assert(j < Capacity2);
      return elements[i][j];
    }
    
    const const_proxy_t operator[] (size_t i) const
    {
      assert(i < Capacity1);
      return const_proxy_t(elements[i]);
    }
    
    void fill(T value=T()){
      for (size_t j=0; j<Capacity1; j++)
	std::fill(&elements[j][0], &elements[j][Capacity2], value);
    }
    const T& operator()(size_t i, size_t j) const
    {
      assert(i < Capacity1);
      assert(j < Capacity2);
      return elements[i][j];
    }

    static size_t capacity1() { return Capacity1; }
    static size_t capacity2() { return Capacity2; }
    static size_t size1() { return Capacity1; }
    static size_t size2() { return Capacity2; }

    const proxy_t operator[] (Player p)
    {
      return operator[](playerToIndex(p));
    }
    const const_proxy_t operator[] (Player p) const
    {
      return operator[](playerToIndex(p));
    }

    bool operator==(const CArray2d& other) const
    {
      return std::equal(&elements[0][0], &elements[0][0]+size1()*size2(),
			&other.elements[0][0]);
    }
  };
  } // namespace osl
  using misc::CArray2d;
} // namespace osl


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