This file is indexed.

/usr/include/trilinos/Teuchos_FilteredIterator.hpp is in libtrilinos-teuchos-dev 12.10.1-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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
// @HEADER
// ***********************************************************************
//
//                    Teuchos: Common Tools Package
//                 Copyright (2004) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
// @HEADER

#ifndef TEUCHOS_FILTERED_ITERATOR_HPP
#define TEUCHOS_FILTERED_ITERATOR_HPP


#include "Teuchos_Assert.hpp"
#include "Teuchos_TypeNameTraits.hpp"
#include "Teuchos_Exceptions.hpp"


namespace Teuchos {


/** \brief C++ Standard Library compatable filtered iterator.
 *
 * Provides a bidirectional iterator providing a filtered view of an
 * underlying iterator (defined by a predicate policy object).
 */
template<class IteratorType, class Predicate>
class FilteredIterator {
public:

  /** \name public typedefs */
  //@{

  /** \brief . */
  typedef	std::bidirectional_iterator_tag iterator_category;
  /** \brief . */
  typedef	typename std::iterator_traits<IteratorType>::value_type	value_type;
  /** \brief . */
  typedef typename std::iterator_traits<IteratorType>::reference reference;
  /** \brief . */
  typedef typename std::iterator_traits<IteratorType>::pointer pointer;
  /** \brief . */
  typedef	typename std::iterator_traits<IteratorType>::difference_type difference_type;

  //@}

  /** \name Constructors. */
  //@{

  /** \brief construct to a null iterator. */
  FilteredIterator()
    {}
  /** \brief Construct with iterator and range.
   * \todo Assert valid range for random-access iterators.
   */
  FilteredIterator(IteratorType current_in, IteratorType begin_in, IteratorType end_in,
    Predicate pred_in = Predicate()
    )
    :current_(current_in), begin_(begin_in), end_(end_in), pred_(pred_in)
    { advanceForwardToValid(); }	
  /** \brief Convert type of iterators (mainly for non-const to const). */
  template<class IteratorType2, class Predicate2>
  FilteredIterator(const FilteredIterator<IteratorType2,Predicate2>& rhs)
    :current_(rhs.current()), begin_(rhs.begin()), end_(rhs.end()), pred_(rhs.pred())
    {}
  /** \brief Assign different types of iterators (mainly for non-const to const). */
  template<class IteratorType2, class Predicate2>
  FilteredIterator & operator=(const FilteredIterator<IteratorType2,Predicate2>& rhs)
    {
      current_ = rhs.current();
      begin_ = rhs.begin();
      end_ = rhs.end();
      pred_ = rhs.pred();
      return *this;
    }

  //@}

  /** @name Access */
  //@{

  /** \brief itr* */
  reference operator*()	const
    { return *current_; }
  /** \brief itr->member */
  pointer operator->() const
    { return current_.operator->(); }

  //@}

  /** @name Incrementation */
  //@{

  /** \brief ++itr */
  FilteredIterator& operator++()
    {
      assertNotIterateForwardPastEnd();
      ++current_;
      advanceForwardToValid();
      return *this;
    }
  /** \brief itr++ */
  const FilteredIterator operator++(int)
    {
      FilteredIterator tmp = *this;
      ++*this;
      return tmp;
    }
  /** \brief --itr */
  FilteredIterator&	operator--()
    {
      assertNotIterateBackwardPastBegin();
      --current_;
      advanceBackwardToValid();
      return *this;
    }
  /** \brief itr-- */
  const FilteredIterator operator--(int)
    {
      FilteredIterator tmp = *this;
      --*this;
      return tmp;
    }

  //@}

  /** @name Implementation access */
  //@{

  /** \brief . */
  IteratorType	current() const { return current_; }
  /** \brief . */
  IteratorType	begin() const { return begin_; }
  /** \brief . */
  IteratorType	end() const { return end_; }
  /** \brief . */
  Predicate pred() const{ return pred_; }

  //@}

private: // Data members

  /** \brief . */
  IteratorType current_;
  /** \brief . */
  IteratorType begin_;
  /** \brief . */
  IteratorType end_;
  /** \brief . */
  Predicate pred_;

private: // Functions

  /** \brief . */
  void advanceForwardToValid();
  /** \brief . */
  void advanceBackwardToValid();
  /** \brief . */
  void assertNotIterateForwardPastEnd()
#ifndef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
    {}
#else
  ;
#endif
  /** \brief . */
  void assertNotIterateBackwardPastBegin()
#ifndef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
    {}
#else
  ;
#endif

};


/** \brief itr1 == itr2.
 * \relates FilteredIterator
 */
template<class IteratorType, class Predicate>
inline bool operator==(const FilteredIterator<IteratorType,Predicate>& itr1,
  const FilteredIterator<IteratorType,Predicate>& itr2)
{
  return itr1.current() == itr2.current();
}


/** \brief itr1 != itr2.
 * \relates FilteredIterator
 */
template<class IteratorType, class Predicate>
inline bool operator!=(const FilteredIterator<IteratorType,Predicate>& itr1,
  const FilteredIterator<IteratorType,Predicate>& itr2)
{
  return itr1.current() != itr2.current();
}


/** \brief ostream operator.
 *
 * WARNING: This requires that IteratorType also support operator<<().
 *
 * \relates FilteredIterator
 */
template<class IteratorType, class Predicate>
std::ostream& operator<<(std::ostream &out, const FilteredIterator<IteratorType,Predicate>& itr)
{
  out << "FilteredIterator{current=???, end=???, pred="<<TypeNameTraits<Predicate>::name()<<"}";
  return out;
}

//
// Template definitions
//


template<class IteratorType, class Predicate>
void FilteredIterator<IteratorType,Predicate>::advanceForwardToValid()
{
  while (current_ != end_ && !pred_(*current_)) {
    ++current_;
  }
}


template<class IteratorType, class Predicate>
void FilteredIterator<IteratorType,Predicate>::advanceBackwardToValid()
{
  while (current_ != begin_ && !pred_(*current_)) {
    --current_;
  }
}


#ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK


template<class IteratorType, class Predicate>
void FilteredIterator<IteratorType,Predicate>::assertNotIterateForwardPastEnd()
{
  const bool current_is_at_end = (current_ == end_);
  TEUCHOS_TEST_FOR_EXCEPTION( current_is_at_end, RangeError,
    "Error, trying to iterate " << *this << " forward ++ past end!");
}


template<class IteratorType, class Predicate>
void FilteredIterator<IteratorType,Predicate>::assertNotIterateBackwardPastBegin()
{
  const bool current_is_at_begin = (current_ == begin_);
  TEUCHOS_TEST_FOR_EXCEPTION( current_is_at_begin, RangeError,
    "Error, trying to iterate " << *this << " backward -- past begin!");
}


#endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK


}	// end namespace Teuchos


#endif // TEUCHOS_FILTERED_ITERATOR_HPP