This file is indexed.

/usr/include/dune/common/dynvector.hh is in libdune-common-dev 2.4.1-1.

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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_DYNVECTOR_HH
#define DUNE_DYNVECTOR_HH

#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <complex>
#include <cstring>
#include <limits>
#include <utility>

#include "exceptions.hh"
#include "genericiterator.hh"

#include <vector>
#include "densevector.hh"

namespace Dune {

  /** @addtogroup DenseMatVec
      @{
   */

  /*! \file
   * \brief This file implements a dense vector with a dynamic size.
   */

  template< class K, class Allocator > class DynamicVector;
  template< class K, class Allocator >
  struct DenseMatVecTraits< DynamicVector< K, Allocator > >
  {
    typedef DynamicVector< K, Allocator > derived_type;
    typedef std::vector< K, Allocator > container_type;
    typedef K value_type;
    typedef typename container_type::size_type size_type;
  };

  template< class K, class Allocator >
  struct FieldTraits< DynamicVector< K, Allocator > >
  {
    typedef typename FieldTraits< K >::field_type field_type;
    typedef typename FieldTraits< K >::real_type real_type;
  };

  /** \brief Construct a vector with a dynamic size.
   *
   * \tparam K is the field type (use float, double, complex, etc)
   * \tparam Allocator type of allocator object used to define the storage allocation model,
   *                default Allocator = std::allocator< K >.
   */
  template< class K, class Allocator = std::allocator< K > >
  class DynamicVector : public DenseVector< DynamicVector< K, Allocator > >
  {
    std::vector< K, Allocator > _data;

    typedef DenseVector< DynamicVector< K, Allocator > > Base;
  public:
    typedef typename Base::size_type size_type;
    typedef typename Base::value_type value_type;

    typedef Allocator allocator_type;

    //! Constructor making uninitialized vector
    explicit DynamicVector(const allocator_type &a = allocator_type() ) :
      _data( a )
    {}

    explicit DynamicVector(size_type n, const allocator_type &a = allocator_type() ) :
      _data( n, value_type(), a )
    {}

    //! Constructor making vector with identical coordinates
    DynamicVector( size_type n, value_type c, const allocator_type &a = allocator_type() ) :
      _data( n, c, a )
    {}

    //! Constructor making vector with identical coordinates
    DynamicVector(const DynamicVector & x) :
      Base(), _data(x._data)
    {}

    //! Move constructor
    DynamicVector(DynamicVector && x) :
      _data(std::move(x._data))
    {}

    template< class T >
    DynamicVector(const DynamicVector< T, Allocator > & x) :
      _data(x.begin(), x.end(), x.get_allocator())
    {}

    //! Copy constructor from another DenseVector
    template< class X >
    DynamicVector(const DenseVector< X > & x, const allocator_type &a = allocator_type() ) :
      _data(a)
    {
      const size_type n = x.size();
      _data.reserve(n);
      for( size_type i =0; i<n ;++i)
        _data.push_back( x[ i ] );
    }

    using Base::operator=;

    //! Copy assignment operator
    DynamicVector &operator=(const DynamicVector &other)
    {
      _data = other._data;
      return *this;
    }

    //! Move assignment operator
    DynamicVector &operator=(DynamicVector &&other)
    {
      _data = std::move(other._data);
      return *this;
    }

    //==== forward some methods of std::vector
    /** \brief Number of elements for which memory has been allocated.

        capacity() is always greater than or equal to size().
     */
    size_type capacity() const
    {
      return _data.capacity();
    }
    void resize (size_type n, value_type c = value_type() )
    {
      _data.resize(n,c);
    }
    void reserve (size_type n)
    {
      _data.reserve(n);
    }

    //==== make this thing a vector
    size_type vec_size() const { return _data.size(); }
    K & vec_access(size_type i) { return _data[i]; }
    const K & vec_access(size_type i) const { return _data[i]; }
  };

  /** \brief Read a DynamicVector from an input stream
   *  \relates DynamicVector
   *
   *  \note This operator is STL compilant, i.e., the content of v is only
   *        changed if the read operation is successful.
   *
   *  \param[in]  in  std :: istream to read from
   *  \param[out] v   DynamicVector to be read
   *
   *  \returns the input stream (in)
   */
  template< class K, class Allocator >
  inline std::istream &operator>> ( std::istream &in,
                                    DynamicVector< K, Allocator > &v )
  {
    DynamicVector< K, Allocator > w(v);
    for( typename DynamicVector< K, Allocator >::size_type i = 0; i < w.size(); ++i )
      in >> w[ i ];
    if(in)
      v = std::move(w);
    return in;
  }

  /** @} end documentation */

} // end namespace

#endif