This file is indexed.

/usr/include/claw/meta/type_list.hpp is in libclaw-dev 1.7.3-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
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
/*
  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 type_list.hpp
 * \brief Template classes for lists of types.
 * \author Julien Jorge
 */
#ifndef __CLAW_TYPE_LIST_HPP__
#define __CLAW_TYPE_LIST_HPP__

#include <claw/meta/conditional.hpp>
#include <claw/meta/no_type.hpp>
#include <claw/meta/same_type.hpp>

namespace claw
{
  namespace meta
  {
    /**
     * \brief Use this class to make a list of types.
     *
     * \b Template \b parameters
     * - \a Head The first type of the list.
     * - \a Queue A list of the remaining types.
     *
     * All type_list methods suppose that the list ends withe the type no_type.
     *
     * \b Example
     *
     * <tt> type_list< int, typelist<float, no_type> ></tt> is a list of two
     * types. The last type (<tt>no_type</tt>) is used to indicate the end of
     * the list.
     *
     * \author Julien Jorge
     */
    template<typename Head, typename Queue>
    struct type_list
    {
      /** \brief The first type in the list. */
      typedef Head head_type;

      /** \brief The remaining types in the list. */
      typedef Queue queue_type;

    }; // struct type_list

    /**
     * \brief Split a type_list according to the first instance of a given type.
     *
     * \b Template \b parameters
     * - \a Delimiter The type on which we split the list
     * - \a TypeList The type_list to split.
     */
    template<typename Delimiter, typename TypeList>
    struct split_type_list_at;

    /** \brief Specialisation of split_type_list_at for an empty list or the
        case where the delimiter is no_type. */
    template<typename Delimiter>
    struct split_type_list_at<Delimiter, no_type>
    {
      /** \brief There is no left part if there is no list. */
      typedef no_type left_part_type;

      /** \brief There is no right part if there is no list. */
      typedef no_type right_part_type;

    }; // struct split_type_list_at

    /**
     * \brief Split a type_list according to the first instance of a given type.
     *
     * \b Template \b parameters
     * - \a Delimiter The type on which we split the list
     * - \a TypeList The type_list to split.
     */
    template<typename Delimiter, typename TypeList>
    struct split_type_list_at
    {
      /** \brief The left part of the list. The delimiter is not included. */
      typedef typename if_then_else
      < same_type<Delimiter, typename TypeList::head_type>::result,
        no_type,             /* delimiter is found, mark the end of the list. */
        type_list            /* otherwise, cut in the remaining types. */
        < typename TypeList::head_type,
          typename split_type_list_at
          <Delimiter, typename TypeList::queue_type>::left_part_type > >::result
      left_part_type;

      /** \brief The right part of the list. The delimiter is included. */
      typedef typename if_then_else
      < same_type<Delimiter, typename TypeList::head_type>::result,
        TypeList,            /* delimiter is found, this is the right part. */
        typename split_type_list_at
        <Delimiter, typename TypeList::queue_type>::right_part_type >::result
      right_part_type;

    }; // struct split_type_list_at

    /**
     * \brief A type list with a single type, more readable than an imbricated
     *        type_list.
     */
    template<typename T1>
    struct type_list_maker_1
    {
      /** \brief The list described by this implementation. */
      typedef type_list<T1, no_type> result;
    }; // struct type_list_maker_1

    /**
     * \brief A type list with two types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2>
    struct type_list_maker_2
    {
      /** \brief The list described by this implementation. */
      typedef type_list< T1, typename type_list_maker_1<T2>::result > result;
    }; // struct type_list_maker_2

    /**
     * \brief A type list with three types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3>
    struct type_list_maker_3
    {
      /** \brief The list described by this implementation. */
      typedef
      type_list< T1, typename type_list_maker_2<T2, T3>::result > result;
    }; // struct type_list_maker_3

    /**
     * \brief A type list with four types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4>
    struct type_list_maker_4
    {
      /** \brief The list described by this implementation. */
      typedef
      type_list< T1, typename type_list_maker_3<T2, T3, T4>::result > result;
    }; // struct type_list_maker_4

    /**
     * \brief A type list with five types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5>
    struct type_list_maker_5
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_4<T2, T3, T4, T5>::result > result;
    }; // struct type_list_maker_5

    /**
     * \brief A type list with six types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6>
    struct type_list_maker_6
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_5<T2, T3, T4, T5, T6>::result > result;
    }; // struct type_list_maker_6

    /**
     * \brief A type list with seven types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7>
    struct type_list_maker_7
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_6<T2, T3, T4, T5, T6, T7>::result > result;
    }; // struct type_list_maker_7

    /**
     * \brief A type list with height types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8>
    struct type_list_maker_8
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_7<T2, T3, T4, T5, T6, T7, T8>::result > result;
    }; // struct type_list_maker_8

    /**
     * \brief A type list with nine types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9>
    struct type_list_maker_9
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_8
	<T2, T3, T4, T5, T6, T7, T8, T9>::result
      > result;
    }; // struct type_list_maker_9

    /**
     * \brief A type list with ten types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9, typename T10>
    struct type_list_maker_10
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_9
	<T2, T3, T4, T5, T6, T7, T8, T9, T10>::result
      > result;
    }; // struct type_list_maker_10

    /**
     * \brief A type list with eleven types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9, typename T10,
	     typename T11>
    struct type_list_maker_11
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_10
	<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::result
      > result;
    }; // struct type_list_maker_11

    /**
     * \brief A type list with twelve types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9, typename T10,
	     typename T11, typename T12>
    struct type_list_maker_12
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_11
	<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::result
      > result;
    }; // struct type_list_maker_12

    /**
     * \brief A type list with thirteen types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9, typename T10,
	     typename T11, typename T12, typename T13>
    struct type_list_maker_13
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_12
	<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::result
      > result;
    }; // struct type_list_maker_13

    /**
     * \brief A type list with fourteen types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9, typename T10,
	     typename T11, typename T12, typename T13, typename T14>
    struct type_list_maker_14
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_13
	<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::result
      > result;
    }; // struct type_list_maker_14

    /**
     * \brief A type list with fifteen types, more readable than an imbricated
     *        type_list.
     */
    template<typename T1, typename T2, typename T3, typename T4, typename T5,
             typename T6, typename T7, typename T8, typename T9, typename T10,
	     typename T11, typename T12, typename T13, typename T14,
	     typename T15>
    struct type_list_maker_15
    {
      /** \brief The list described by this implementation. */
      typedef type_list
      < T1,
        typename type_list_maker_14
	<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::result
      > result;
    }; // struct type_list_maker_15

    /**
     * \brief A type list with up to six types, more readable than an
     *        imbricated type_list, more readable than type_list_maker_1 and
     *        others.
     */
    template< typename T1, typename T2 = no_type, typename T3 = no_type,
              typename T4 = no_type, typename T5 = no_type,
	      typename T6 = no_type, typename T7 = no_type,
	      typename T8 = no_type, typename T9 = no_type,
	      typename T10 = no_type, typename T11 = no_type,
	      typename T12 = no_type, typename T13 = no_type,
	      typename T14 = no_type, typename T15 = no_type >
    struct type_list_maker
    {
      /** \brief The list described by this implementation. */
      typedef typename split_type_list_at
      < no_type,
        typename type_list_maker_15
	< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14,
	  T15 >::result
      >::left_part_type result;
    }; // struct type_list_maker

    /**
     * \brief Check if a type is present in a type_list.
     *
     * \b Template \b paramters
     * - \a T The type to find.
     * - \a List The list in which we search the type.
     *
     * \b Type \b requirements
     * - \a List is either no_type, either a type_list<> ended with no_type.
     *
     * \author Julien Jorge
     */
    template<typename T, typename List>
    struct type_list_find
    {
      enum
	{
	  result = same_type<T, typename List::head_type>::result
	  || type_list_find<T, typename List::queue_type>::result
	};
    }; // struct type_list_find

    template<typename T>
    struct type_list_find<T, no_type>
    {
      enum
	{
	  result = same_type<T, no_type>::result
	};
    }; // struct type_list_find

    /**
     * \brief This class checks if each type in a type_list<> is present only
     *        once.
     *
     * \author Julien Jorge
     */
    template<typename List>
    struct type_list_is_a_set
    {
      enum
	{
	  result = !type_list_find<typename List::head_type,
	                           typename List::queue_type>::result 
	  && type_list_is_a_set<typename List::queue_type>::result
	};
    }; // struct type_list_is_a_set

    template<>
    struct type_list_is_a_set<no_type>
    {
      enum
	{
	  result = true
	};
    }; // struct type_list_is_a_set [no_type]

    /**
     * \brief This class computes the length of a list of types.
     *
     * \author Julien Jorge
     */
    template<typename List>
    struct type_list_length
    {
      enum
	{
	  result = 1 + type_list_length<typename List::queue_type>::result
	};
    }; // struct type_list_length

    template<>
    struct type_list_length<no_type>
    {
      enum
	{
	  result = 0
	};
    }; // struct type_list_length [no_type]

    /**
     * \brief Tell if a given type list contains a given type.
     * \param T The type to search.
     * \param List The list in which the type is searched.
     *
     * \author Julien Jorge
     */
    template<typename T, typename List>
    struct type_list_contains;

    template<typename T, typename Tail>
    struct type_list_contains< T, type_list<T, Tail> >
    {
      enum
	{
	  result = true
	};
    }; // struct type_list_contains

    template<typename T>
    struct type_list_contains< T, no_type >
    {
      enum
	{
	  result = false
	};
    }; // struct type_list_contains

    template<typename T, typename Head, typename Tail>
    struct type_list_contains< T, type_list<Head, Tail> >
    {
      enum
	{
	  result = type_list_contains<T, Tail>::result
	};
    }; // struct type_list_contains

    /** \brief The list of the types of the C++ language. */
    typedef type_list_maker
    < signed char, unsigned char,
      signed short, unsigned short,
      signed int, unsigned int,
      signed long, unsigned long,
#ifndef __STRICT_ANSI__
      signed long long, unsigned long long,
#endif
      float,
      double,
      long double,
      bool >::result cpp_type_list;

  } // namespace meta
} // namespace claw

#endif // __CLAW_TYPE_LIST_HPP__