This file is indexed.

/usr/include/dune/pdelab/common/utility.hh is in libdune-pdelab-dev 2.0.0-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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:

#ifndef DUNE_PDELAB_COMMON_UTILITY_HH
#define DUNE_PDELAB_COMMON_UTILITY_HH

#include <dune/common/shared_ptr.hh>

namespace Dune {
  namespace PDELab {


    /** \addtogroup common Common Utilities
     *  \ingroup PDELab
     *  \{
     */

    //! Ensures that t is wrapped in a shared_ptr<T>
    /**
     * You have to consider three situations:
     *
     * a) t is of type T&
     *  t is a stack object and must not be deleted.
     *  You create a shared_ptr<T>(&t) with a null_deleter.
     *  b) t is of type T*
     *  t is a raw pointer and the user os assumed to own this pointer.
     *  You create a shared_ptr<T>(t) with a null_deleter.
     *  c) t is of type shared_ptr<T>
     *  t is already a shared_ptr<T>.
     *  You don't have to do anything.
     */
    template<typename T>
    shared_ptr<T> ensure_shared_ptr(T & t)
    {
      return shared_ptr<T>(&t, null_deleter<T>());
    }

#ifndef DOXYGEN

    template<typename T>
    shared_ptr<T> ensure_shared_ptr(T * t)
    {
      return shared_ptr<T>(t, null_deleter<T>());
    }

    template<typename T>
    shared_ptr<T> & ensure_shared_ptr(shared_ptr<T> & t)
    {
      return t;
    }

#endif // DOXYGEN

    //! \}

  } // namespace PDELab
} //namespace Dune

#endif // DUNE_PDELAB_COMMON_UTILITY_HH