This file is indexed.

/usr/include/dune/common/static_assert.hh is in libdune-common-dev 2.2.1-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
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 sw=2 sts=2:
#ifndef DUNE_STATIC_ASSERT_HH
#define DUNE_STATIC_ASSERT_HH

/** \file
 * \brief Fallback implementation of the C++0x static_assert feature
 */

/** 
 * @addtogroup Common
 *
 * @{
 */

#if not HAVE_STATIC_ASSERT
// Taken from BOOST
//
// Helper macro CPPMAGIC_JOIN:
// The following piece of macro magic joins the two
// arguments together, even when one of the arguments is
// itself a macro (see 16.3.1 in C++ standard).  The key
// is that macro expansion of macro arguments does not
// occur in CPPMAGIC_DO_JOIN2 but does in CPPMAGIC_DO_JOIN.
//
#define CPPMAGIC_JOIN( X, Y ) CPPMAGIC_DO_JOIN( X, Y )
#define CPPMAGIC_DO_JOIN( X, Y ) CPPMAGIC_DO_JOIN2(X,Y)
#define CPPMAGIC_DO_JOIN2( X, Y ) X##Y

template <bool x> struct static_assert_failure;

template <> struct static_assert_failure<true> { };

template<int x> struct static_assert_test{};
#endif

/**
    \brief Helper template so that compilation fails if condition is not true.

    \code
    #include <dune/common/static_assert.hh>
    dune_static_assert(CONDITION, ERRORMSG);
    \endcode
    
    If CONDITION is not true, dune_static_assert fails.

    If the C++0x language feature static_assert is available, dune_static_assert
    forwards everything to static_assert. Otherwise dune_static_assert implements a
    test that triggers a compile time error if the condition is false.

    Example:

    \code
    dune_static_assert(1<=2, "error");
    dune_static_assert((is_same<int,int>::value),  "error msg");
    dune_static_assert((is_same<bool,int>::value), "error msg"); // false, will trigger a compile time error
    \endcode

    \note
    \code
dune_static_assert(false, "error");
    \endcode
    will usually not do what was intended, see Dune::AlwaysFalse for a way to
    achieve the desired result.

    Be aware that...
    <ol>
    <li>dune_static_assert is not in the namespace Dune</li>
    <li>you must use extra parentheses if your condition contains ','.
    This is because dune_static_assert is a preprocessor macro</li>
    </ol>
    
*/

#if HAVE_STATIC_ASSERT
#define dune_static_assert(COND,MSG) \
    static_assert(COND,MSG)
#else
#define dune_static_assert(COND,MSG) \
    typedef static_assert_test<                         \
      sizeof(static_assert_failure< (bool)( COND )>)\
      > CPPMAGIC_JOIN(dune_static_assert_typedef_, __LINE__)
#endif

namespace Dune {
  //! template which always yields a false value
  /**
   *  \tparam T Some type.  It sould be a type expression involving template
   *            parameters of the class or function using AlwaysFalse.
   *
   *  Suppose you have a template class.  You want to document the required
   *  members of this class in the non-specialized template, but you know that
   *  actually instantiating the non-specialized template is an error.  You
   *  can try something like this:
   *  \code
template<typename T>
struct Traits {
  dune_static_assert(false,
                     "Instanciating this non-specialized template is an "
                     "error.  You should use one of the specializations "
                     "instead.");
  //! The type used to frobnicate T
  typedef void FrobnicateType;
};
   *  \endcode
   *  This will trigger dune_static_assert() as soon as the compiler reads the
   *  definition for the Traits template, since it knows that "false" can
   *  never become true, no matter what the template parameters of Traits are.
   *  As a workaround you can use AlwaysFalse: replace <tt>false</tt> by
   *  <tt>AlwaysFalse<T>::value</tt>, like this:
   *  \code
template<typename T>
struct Traits {
  dune_static_assert(AlwaysFalse<T>::value,
                     "Instanciating this non-specialized template is an "
                     "error.  You should use one of the specializations "
                     "instead.");
  //! The type used to frobnicate T
  typedef void FrobnicateType;
};
   *  \endcode
   *  Since there might be an specialization of AlwaysFalse for template
   *  parameter T, the compiler cannot trigger dune_static_assert() until the
   *  type of T is known, that is, until Traits<T> is instantiated.
   */
  template<typename T>
  struct AlwaysFalse {
    //! always a false value
    static const bool value = false;
  };

  //! template which always yields a true value
  /**
   *  \tparam T Some type.  It sould be a type expression involving template
   *            parameters of the class or function using AlwaysTrue.
   *
   *  \note This class exists mostly for consistency with AlwaysFalse.
   */
  template<typename T>
  struct AlwaysTrue {
    //! always a true value
    static const bool value = true;
  };
} // namespace Dune

/* @} */

#endif