This file is indexed.

/usr/include/claw/functional.hpp is in libclaw-dev 1.7.4-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
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
/*
  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 functional.hpp
 * \brief Some function object classes.
 * \author Julien Jorge
 */
#ifndef __CLAW_FUNCTIONAL_HPP__
#define __CLAW_FUNCTIONAL_HPP__

#include <utility>
#include <functional>

namespace claw
{
  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the first element of a std::pair.
   * \author Julien Jorge
   */
  template <class T1, class T2>
  class first: public std::unary_function< std::pair<T1, T2>, T1& >  
  {
  public:
    T1& operator()( std::pair<T1, T2>& p ) const 
    {
      return p.first;
    } // operator() const
  }; // class first

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the first element of a std::pair.
   * \author Julien Jorge
   */
  template <class T1, class T2>
  class const_first:
    public std::unary_function<const std::pair<T1, T2>, const T1&>
  {
  public:
    const T1& operator()( const std::pair<T1, T2>& p ) const 
    {
      return p.first;
    } // operator()

  }; // class const_first

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the first element of a std::pair.
   *
   * \remark Contrary to claw::first, the template argument is a std::pair.
   * \author Julien Jorge
   */
  template<class Pair>
  class pair_first:
    public first<typename Pair::first_type, typename Pair::second_type>
  {
    // nothing
  }; // class pair_first

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the first element of a std::pair.
   *
   * \remark Contrary to claw::first, the template argument is a std::pair.
   * \author Julien Jorge
   */
  template<class Pair>
  class const_pair_first:
    public const_first<typename Pair::first_type, typename Pair::second_type>
  {
    // nothing
  }; // class const_pair_first

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the second element of a std::pair.
   * \author Julien Jorge
   */
  template <class T1, class T2>
  class second: public std::unary_function< std::pair<T1, T2>, T2& >  
  {
  public:
    T2& operator()( std::pair<T1, T2>& p ) const 
    {
      return p.second;
    } // operator() const
  }; // class second

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the second element of a std::pair.
   * \author Julien Jorge
   */
  template <class T1, class T2>
  class const_second:
    public std::unary_function< const std::pair<T1, T2>, const T2& >  
  {
  public:
    const T2& operator()( const std::pair<T1, T2>& p ) const 
    {
      return p.second;
    } // operator()

  }; // class const_second

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the second element of a std::pair.
   *
   * \remark Contrary to claw::second, the template argument is a std::pair.
   * \author Julien Jorge
   */
  template< class Pair >
  class pair_second: public second< typename Pair::first_type,
                                     typename Pair::second_type >
  {
    // nothing
  }; // class pair_second

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Fuction object to get the second element of a std::pair.
   *
   * \remark Contrary to claw::second, the template argument is a std::pair.
   * \author Julien Jorge
   */
  template<class Pair>
  class const_pair_second:
    public const_second<typename Pair::first_type, typename Pair::second_type>
  {
  public:
    const_pair_second() {}

    template<typename F, typename S>
    const_pair_second( const second<F, S>& )
      {}

  }; // class const_pair_second

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Always true unary predicate.
   *
   * \b Template \b arguments:
   * - T Doesn't matter.
   *
   * \remark Use it when you need to process all elements but a method needs
   *         an unary predicate parameter.
   * \author Julien Jorge
   */
  template<class T>
  class unary_true: public std::unary_function<T, bool>
  {
  public:
    bool operator()( const T& t ) const { return true; }
  }; // class unary_true

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Always true binary predicate.
   *
   * \b Template \b arguments:
   * - T Doesn't matter,
   * - U Doesn't matter.
   *
   * \remark Use it when you need to process all elements but a method needs
   *         an binary predicate parameter.
   * \author Julien Jorge
   */
  template<class T, class U>
  class binary_true: public std::binary_function<T, U, bool>
  {
  public:
    bool operator()( const T& t, const U& u ) const
    {
      return true;
    } // operator()
  }; // class binary_true

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Function object that compose two function objects.
   *
   * \b Template \b arguments:
   * - \a F1 The type of the first function, must be a model of Adaptable Unary
   *   Function,
   * - \a F2 The type of the second function, must be a model of Adaptable Unary
   *   Function.
   *
   * \author Julien Jorge
   */
  template<typename F1, typename F2>
  class unary_compose
   : public std::unary_function< typename F2::argument_type,
                                  typename F1::result_type >
  {
  public:
    unary_compose() {}

    /**
     * \brief Copy constructor.
     * \param that The instance to copy from.
     *
     * There is actually nothing to copy but this constructor is useful for
     * casting function objects.
     */
    template<typename G1, typename G2>
    unary_compose( const unary_compose<G1, G2>& that ) { }
      
    /**
     * \brief Return (F1 o F2)(a).
     */
    typename F1::result_type
    operator()( typename F2::argument_type& a ) const
    {
      return F1()( F2()(a) );
    }
  }; // class unary_compose

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Function object that deletes a pointer.
   *
   * \b Template \b arguments:
   * - \a T The pointer type.
   *
   * \remark Use this function object to clear your container of pointers.
   * \author Julien Jorge
   */
  template<typename T>
  class delete_function: public std::unary_function<T, void>
  {
  public:
    void operator()( const T& a ) const
    {
      delete a;
    }
  }; // class delete_function

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Function object that clones a pointer.
   *
   * \b Template \b arguments:
   * - \a T The pointed type (ie. <tt>int</tt>, not <tt>int*</tt>.
   *
   * \remark Use this function object to copy your container of pointers.
   * \author Julien Jorge
   */
  template<typename T>
  class clone: public std::unary_function<T*, T*>
  {
  public:
    T* operator()( const T* a ) const
    {
      return new T(*a);
    }
  }; // class clone

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Function object that dereferences a pointer.
   *
   * \b Template \b arguments:
   * - \a T The pointed type (ie. <tt>int</tt>, not <tt>int*</tt>.
   *
   * \author Julien Jorge
   */
  template<typename T>
  class dereference:
    public std::unary_function<T*, T&>
  {
  public:
    T& operator()( T* a ) const
    {
      return *a;
    }

  }; // class dereference

  /*-------------------------------------------------------------------------*/
  /**
   * \brief Function object that dereferences a constant pointer.
   *
   * \b Template \b arguments:
   * - \a T The pointed type (ie. <tt>int</tt>, not <tt>int*</tt>.
   *
   * \author Julien Jorge
   */
  template<typename T>
  class const_dereference:
    public std::unary_function<const T*, const T&>
  {
  public:
    const_dereference() { }
    const_dereference( const dereference<T>& ) { }
    const_dereference( const const_dereference<T>& ) { }

    const T& operator()( const T* a ) const
    {
      return *a;
    }

  }; // class const_dereference
} // namespace claw

#endif // __CLAW_FUNCTIONAL_HPP__