This file is indexed.

/usr/include/glbinding/SharedBitfield.h is in libglbinding-dev 2.1.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
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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
#pragma once

#include <type_traits>


namespace glbinding 
{

/**
 * @brief
 *   A representation of a bitfield value that could be member of multiple bitfield types as allowed in OpenGL.
 *
 * @param Types
 *   The valid bitfield types for the given value.
 */
template <typename... Types>
class SharedBitfield;

// intersection

/**
 * @brief
 *   Break condition for the is_member_of_SharedBitfield metaprogramming.
 *
 * @param T
 *   The type to test for membership.
 * @param Types
 *   The tail of the list of Types.
 *
 * This template is used if the list of Types is empty.
 */
template<typename T, typename... Types>
struct is_member_of_SharedBitfield
{
    static const bool value = false; ///< result of the inclusion test; always false since the list of types to test against is empty
};

/**
 * @brief
 *   Test condition and recursion for the is_member_of_SharedBitfield metaprogramming.
 *
 * @param T
 *   The type to test for membership.
 * @param U
 *   The current head of the list of Types.
 * @param Types
 *   The tail of the list of Types.
 */
template<typename T, typename U, typename... Types>
struct is_member_of_SharedBitfield<T, U, Types...>
{
    static const bool value = std::conditional<std::is_same<T, U>::value, std::true_type, is_member_of_SharedBitfield<T, Types...>>::type::value; ///< result of the inclusion test
};

/**
 * @brief
 *   Break condition for the SharedBitfield type concatenation.
 *
 * This template is used if ...
 */
template<typename, typename>
struct prepend_to_SharedBitfield
{
};

/**
 * @brief
 *  The SharedBitfield type concatenation.
 *
 * @param T
 *  The new head of the list of Types
 * @param Types
 *  The tail of the list of Types
 */
template<typename T, typename... Types>
struct prepend_to_SharedBitfield<T, SharedBitfield<Types...>>
{
    using type = SharedBitfield<T, Types...>; ///< the compound SharedBitfield type
};

/**
 * @brief
 *   Break condition for the SharedBitfield intersection.
 */
template<typename, typename>
struct intersect_SharedBitfield
{
    using type = SharedBitfield<>; ///< Result of the intersection; always empty for non-overlapping SharedBitfield type lists
};

/**
 * @brief
 *   The SharedBitfield type list intersection.
 *
 * @param T
 *   Head of the first SharedBitfield type list.
 * @param Types
 *   Tail of the first SharedBitfield type list.
 * @param OtherTypes
 *   Head and Tail of the second SharedBitfield type list.
 */
template<typename T, typename... Types, typename... OtherTypes>
struct intersect_SharedBitfield<SharedBitfield<T, Types...>, SharedBitfield<OtherTypes...>>
{
    using type = typename std::conditional<!is_member_of_SharedBitfield<T, OtherTypes...>::value, typename intersect_SharedBitfield<SharedBitfield<Types...>, SharedBitfield<OtherTypes...>>::type, typename prepend_to_SharedBitfield<T, typename intersect_SharedBitfield<SharedBitfield<Types...>, SharedBitfield<OtherTypes...>>::type>::type>::type; ///< Result of the intersection
};


// implementation


/**
 * @brief
 *   The base class of a SharedBitfield, containing the actual (and convertible) bitfield value.
 *
 * @param T
 *   The underlying type of the type-safe enum class.
 */
template <typename T>
class SharedBitfieldBase
{
public:
    using UnderlyingType = T; ///< Propagate underlying type

    /**
     * @brief
     *   Constructor
     *
     * @param[in] value
     *   The value encoded in this shared bitfield.
     */
    SharedBitfieldBase(T value);

    /**
     * @brief
     *   Cast operator to the underlying type.
     *
     * @return
     *   The bitfield value.
     */
    explicit operator T() const;
protected:
    T m_value; ///< The value of the SharedBitfield
};

/**
 * @brief
 *   Invalid SharedBitfield class as it contains no valid bitfield types.
 */
template <>
class SharedBitfield<>
{};

/**
 * @brief
 *   A representation of a bitfield value that could be member of multiple bitfield types as allowed in OpenGL.
 *   This template is the break condition of a former SharedBitfield that got reduced to just one valid bitfield type through operations.
 *
 * @param Type
 *   The one valid bitfield type for the given value.
 */
template <typename Type>
class SharedBitfield<Type> : public SharedBitfieldBase<typename std::underlying_type<Type>::type>
{
public:
    using UnderlyingType = typename SharedBitfieldBase<typename std::underlying_type<Type>::type>::UnderlyingType; ///< inherit UnderlyingType declaration

    /**
     * @brief
     *   Constructor
     *
     * @tparam ConstructionType
     *   The type of the passed value which is implicitly convertible to the UnderlyingType.
     * @param[in] value
     *   The value of this SharedBitfield.
     */
    template <typename ConstructionType>
    SharedBitfield(ConstructionType value);

    /**
     * @brief
     *   Constructor
     *
     * @param[in] value
     *   The value of this SharedBitfield.
     */
    SharedBitfield(typename std::underlying_type<Type>::type value);

    /**
     * @brief
     *   Cast operator to allow for conversion of the generic value to a specific bitfield type.
     *
     * @return
     *   The bitfield value as type of Type.
     */
    operator Type() const;

    /**
     * @brief
     *   Performs a bit-wise 'or' operation on the values of this and other while constraining the resulting shared bitfield types to the intersection.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   The new SharedBitfield with intersected types list and computed value.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator|(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;

    /**
     * @brief
     *   Performs a bit-wise 'or' assignment operation on the values of this and other, where type list of the right hand side has to be a superset of the types list of this SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator|=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;

    /**
     * @brief
     *   Performs a bit-wise 'and' operation on the values of this and other while constraining the resulting shared bitfield types to the intersection.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   The new SharedBitfield with intersected types list and computed value.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator&(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;

    /**
     * @brief
     *   Performs a bit-wise 'and' assignment operation on the values of this and other, where type list of the right hand side has to be a superset of the types list of this SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator&=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;

    /**
     * @brief
     *   Performs a bit-wise 'xor' operation on the values of this and other while constraining the resulting shared bitfield types to the intersection.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   The new SharedBitfield with intersected types list and computed value.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator^(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;

    /**
     * @brief
     *   Performs a bit-wise 'xor' assignment operation on the values of this and other, where type list of the right hand side has to be a superset of the types list of this SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator^=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;

    /**
     * @brief
     *   Test for equality of the values of this SharedBitfield and the other SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   true iff the values equals
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator==(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, bool>::type;

    /**
     * @brief
     *   Test for equality of the value of this SharedBitfield and the other bitfield value.
     *
     * @tparam T
     *   The bitfield type of the value to test
     * @param[in] other
     *   The bitfield value to operate with..
     *
     * @return
     *   true iff the values equals
     *
     * This method is not visible to the compiler if the this SharedBitfield type list contains the type T.
     */
    template <typename T>
    auto operator==(T other) const -> typename std::enable_if<is_member_of_SharedBitfield<T, Type>::value, bool>::type;
};

/**
 * @brief
 *   A representation of a bitfield value that could be member of multiple bitfield types as allowed in OpenGL.
 *
 * @param Type
 *   The head of valid bitfields type for the given value.
 * @param Types
 *   The tail of valid bitfields type for the given value.
 */
template <typename Type, typename... Types>
class SharedBitfield<Type, Types...> : public SharedBitfield<Types...>
{
public:
    using UnderlyingType = typename SharedBitfield<Types...>::UnderlyingType; ///< inherit UnderlyingType declaration

    /**
     * @brief
     *   Constructor
     *
     * @tparam ConstructionType
     *   The type of the passed value which is implicitly convertible to the UnderlyingType.
     * @param[in] value
     *   The value of this SharedBitfield.
     */
    template <typename ConstructionType>
    SharedBitfield(ConstructionType value);

    /**
     * @brief
     *   Constructor
     *
     * @param[in] value
     *   The value of this SharedBitfield.
     */
    SharedBitfield(typename std::underlying_type<Type>::type value);

    /**
     * @brief
     *   Cast operator to allow for conversion of the generic value to a specific bitfield type.
     *
     * @return
     *   The bitfield value as type of Type.
     */
    operator Type() const;

    /**
     * @brief
     *   Performs a bit-wise 'or' operation on the values of this and other while constraining the resulting shared bitfield types to the intersection.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   The new SharedBitfield with intersected types list and computed value.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator|(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;

    /**
     * @brief
     *   Performs a bit-wise 'or' assignment operation on the values of this and other, where type list of the right hand side has to be a superset of the types list of this SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator|=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;

    /**
     * @brief
     *   Performs a bit-wise 'and' operation on the values of this and other while constraining the resulting shared bitfield types to the intersection.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   The new SharedBitfield with intersected types list and computed value.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator&(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;

    /**
     * @brief
     *   Performs a bit-wise 'and' assignment operation on the values of this and other, where type list of the right hand side has to be a superset of the types list of this SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator&=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;

    /**
     * @brief
     *   Performs a bit-wise 'xor' operation on the values of this and other while constraining the resulting shared bitfield types to the intersection.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   The new SharedBitfield with intersected types list and computed value.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator^(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;

    /**
     * @brief
     *   Performs a bit-wise 'xor' assignment operation on the values of this and other, where type list of the right hand side has to be a superset of the types list of this SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator^=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;

    /**
     * @brief
     *   Test for equality of the values of this SharedBitfield and the other SharedBitfield.
     *
     * @param[in] other
     *   The SharedBitfield instance to operate with.
     *
     * @return
     *   true iff the values equals
     *
     * This method is not visible to the compiler if the operands don't share any bitfield type (the intersection is empty) and thus results in a compiler error.
     */
    template <typename... T>
    auto operator==(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, bool>::type;

    /**
     * @brief
     *   Test for equality of the value of this SharedBitfield and the other bitfield value.
     *
     * @tparam T
     *   The bitfield type of the value to test
     * @param[in] other
     *   The bitfield value to operate with..
     *
     * @return
     *   true iff the values equals
     *
     * This method is not visible to the compiler if the this SharedBitfield type list contains the type T.
     */
    template <typename T>
    auto operator==(T other) const -> typename std::enable_if<is_member_of_SharedBitfield<T, Type, Types...>::value, bool>::type;
};


// operators


/**
 * @brief
 *   External bit-wise 'or' operator for bitfield types on the left hand side.
 *
 * @tparam Enum
 *   The type of the bitfield
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @param[in] a
 *   The value of the bitfield
 * @param[in] b
 *   The value of the SharedBitfield
 *
 * @return
 *   A SharedBitfield with computed value.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename Enum, typename ConvertibleEnum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator|(Enum a, ConvertibleEnum b);

/**
 * @brief
 *   External bit-wise 'or' operator for bitfield types on the right hand side.
 *
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @tparam Enum
 *   The type of the bitfield
 * @param[in] a
 *   The value of the SharedBitfield
 * @param[in] b
 *   The value of the bitfield
 *
 * @return
 *   A SharedBitfield with computed value.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename ConvertibleEnum, typename Enum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator|(ConvertibleEnum a, Enum b);

/**
 * @brief
 *   External bit-wise 'or' assignment operator for bitfield types on the left hand side.
 *
 * @tparam Enum
 *   The type of the bitfield
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @param[in] a
 *   The value of the bitfield
 * @param[in] b
 *   The value of the SharedBitfield
 *
 * @return
 *   The new value of the bitfield.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename Enum, typename ConvertibleEnum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator|=(Enum & a, ConvertibleEnum b);

/**
 * @brief
 *   External bit-wise 'and' operator for bitfield types on the left hand side.
 *
 * @tparam Enum
 *   The type of the bitfield
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @param[in] a
 *   The value of the bitfield
 * @param[in] b
 *   The value of the SharedBitfield
 *
 * @return
 *   A SharedBitfield with computed value.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename Enum, typename ConvertibleEnum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator&(Enum a, ConvertibleEnum b);

/**
 * @brief
 *   External bit-wise 'and' operator for bitfield types on the right hand side.
 *
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @tparam Enum
 *   The type of the bitfield
 * @param[in] a
 *   The value of the SharedBitfield
 * @param[in] b
 *   The value of the bitfield
 *
 * @return
 *   A SharedBitfield with computed value.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename ConvertibleEnum, typename Enum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator&(ConvertibleEnum a, Enum b);

/**
 * @brief
 *   External bit-wise 'and' assignment operator for bitfield types on the left hand side.
 *
 * @tparam Enum
 *   The type of the bitfield
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @param[in] a
 *   The value of the bitfield
 * @param[in] b
 *   The value of the SharedBitfield
 *
 * @return
 *   The new value of the bitfield.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename Enum, typename ConvertibleEnum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator&=(Enum & a, ConvertibleEnum b);

/**
 * @brief
 *   External bit-wise 'xor' operator for bitfield types on the left hand side.
 *
 * @tparam Enum
 *   The type of the bitfield
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @param[in] a
 *   The value of the bitfield
 * @param[in] b
 *   The value of the SharedBitfield
 *
 * @return
 *   A SharedBitfield with computed value.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename Enum, typename ConvertibleEnum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator^(Enum a, ConvertibleEnum b);

/**
 * @brief
 *   External bit-wise 'xor' operator for bitfield types on the right hand side.
 *
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @tparam Enum
 *   The type of the bitfield
 * @param[in] a
 *   The value of the SharedBitfield
 * @param[in] b
 *   The value of the bitfield
 *
 * @return
 *   A SharedBitfield with computed value.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename ConvertibleEnum, typename Enum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator^(ConvertibleEnum a, Enum b);

/**
 * @brief
 *   External bit-wise 'xpyor' assignment operator for bitfield types on the left hand side.
 *
 * @tparam Enum
 *   The type of the bitfield
 * @tparam ConvertibleEnum
 *   The SharedBitfield instance
 * @param[in] a
 *   The value of the bitfield
 * @param[in] b
 *   The value of the SharedBitfield
 *
 * @return
 *   The new value of the bitfield.
 *
 * This method is not visible to the compiler if the bitfield type is not in the list of types of the SharedBitfield and thus results in a compiler error.
 */
template <typename Enum, typename ConvertibleEnum>
typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
operator^=(Enum & a, ConvertibleEnum b);


} // namespace glbinding


#include <glbinding/SharedBitfield.inl>