This file is indexed.

/usr/include/claw/impl/ordered_set.tpp is in libclaw-dev 1.7.4-2.

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
/*
  CLAW - a C++ Library Absolutely Wonderful

  CLAW is a free library without any particular aim but being useful to 
  anyone.

  Copyright (C) 2005-2011 Julien Jorge

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library 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
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

  contact: julien.jorge@gamned.org
*/
/**
 * \file ordered_set.tpp
 * \brief Implementation of the claw::math::ordered_set
 * \author Julien Jorge
 */
#include <list>

/*----------------------------------------------------------------------------*/
template<class K, class Comp>
Comp claw::math::ordered_set<K,Comp>::s_key_comp;

/*----------------------------------------------------------------------------*/
/**
 * \brief Intersection.
 * \param that The instance to intersect from.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::operator*=( const ordered_set& that )
{
  return intersection( that );
} // ordered_set::operator*=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Union.
 * \param that The instance to join with.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::operator+=( const ordered_set& that )
{
  return join( that );
} // ordered_set::operator+=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Difference.
 * \param that The instance from which to remove items.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::operator-=( const ordered_set& that )
{
  return difference( that );
} // ordered_set::operator-=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Symetric difference.
 * \param that The instance to differ from.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::operator/=( const ordered_set& that )
{
  return symetric_difference( that );
} // ordered_set::operator/=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Inclusion.
 * \param that The instance that should be contained.
 * \return true if that is strictly included in this.
 */
template<class K, class Comp>
bool
claw::math::ordered_set<K, Comp>::operator>( const ordered_set& that ) const
{
  return strictly_contains( that );
} // ordered_set::operator>()

/*----------------------------------------------------------------------------*/
/**
 * \brief Inclusion or equality.
 * \param that The instance that should be contained.
 * \return true if that is included in this.
 */
template<class K, class Comp>
bool
claw::math::ordered_set<K, Comp>::operator>=( const ordered_set& that ) const
{
  return contains( that );
} // ordered_set::operator>=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Inclusion.
 * \param that The instance that should contain.
 * \return true if that is strictly included in this.
 */
template<class K, class Comp>
bool
claw::math::ordered_set<K, Comp>::operator<( const ordered_set& that ) const
{
  return that.strictly_contains( *this );
} // ordered_set::operator<()

/*----------------------------------------------------------------------------*/
/**
 * \brief Inclusion or equality.
 * \param that The instance that should be contained.
 * \return true if that is included in this.
 */
template<class K, class Comp>
bool
claw::math::ordered_set<K, Comp>::operator<=( const ordered_set& that ) const
{
  return that.contains( *this );
} // ordered_set::operator<=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Intersection.
 * \param that The instance to intersect from.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::intersection( const ordered_set& that )
{
  std::list<K> remove_us;
  const_iterator it;
  
  for (it=super::begin(); it!=super::end(); ++it)
    if ( that.find( *it ) == that.end() )
      remove_us.push_front( *it );

  typename std::list<K>::const_iterator remove_it;

  for (remove_it=remove_us.begin(); remove_it!=remove_us.end(); ++remove_it)
    super::erase( *remove_it );

  return *this;
} // ordered_set::intersection()

/*----------------------------------------------------------------------------*/
/**
 * \brief Union.
 * \param that The instance to join with.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::join( const ordered_set& that )
{
  const_iterator it;
  
  for (it=that.begin(); it!=that.end(); ++it)
    super::insert( *it );

  return *this;
} // ordered_set::join()

/*----------------------------------------------------------------------------*/
/**
 * \brief Difference.
 * \param that The instance from which to remove items.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::difference( const ordered_set& that )
{
  std::list<K> remove_us;
  const_iterator it;
  
  for (it=super::begin(); it!=super::end(); ++it)
    if ( that.find( *it ) != that.end() )
      remove_us.push_front( *it );

  typename std::list<K>::const_iterator remove_it;

  for (remove_it=remove_us.begin(); remove_it!=remove_us.end(); ++remove_it)
    super::erase( *remove_it );

  return *this;
} // ordered_set::difference()

/*----------------------------------------------------------------------------*/
/**
 * \brief Symetric difference.
 * \param that The instance to differ from.
 */
template<class K, class Comp>
claw::math::ordered_set<K, Comp>&
claw::math::ordered_set<K, Comp>::symetric_difference( const ordered_set& that )
{
  ordered_set<K, Comp> my_copy(*this), his_copy(that);

  return difference( that ).join( his_copy.difference(my_copy) );
} // ordered_set::symetric_difference()

/*----------------------------------------------------------------------------*/
/**
 * \brief Inclusion or equality.
 * \param that The instance that should be contained.
 * \return true if that is included in this.
 */
template<class K, class Comp>
bool
claw::math::ordered_set<K, Comp>::contains( const ordered_set& that ) const
{
  bool ok = super::size() >= that.size();
  const_iterator it_this( super::begin() );
  const_iterator it_that( that.begin() );

  while ( ok && (it_that != that.end()) && (it_this != super::end()) )
    if ( s_key_comp( *it_this, *it_that ) )
      ++it_this;
    else if ( s_key_comp( *it_that, *it_this ) )
      ok = false;
    else
      {
        ++it_this;
        ++it_that;
      }

  return it_that == that.end();
} // ordered_set::contains()

/*----------------------------------------------------------------------------*/
/**
 * \brief Inclusion.
 * \param that The instance that should contain.
 * \return true if that is strictly included in this.
 */
template<class K, class Comp>
bool
claw::math::ordered_set<K, Comp>::strictly_contains
( const ordered_set& that ) const
{
  return contains(that) && ( super::size() > that.size() );
} // ordered_set::strictly_contains()