/usr/include/dune/common/typeutilities.hh is in libdune-common-dev 2.5.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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_COMMON_TYPEUTILITIES_HH
#define DUNE_COMMON_TYPEUTILITIES_HH
#include <cstddef>
#include <type_traits>
#include <tuple>
namespace Dune {
/**
* \file
* \brief Utilities for type computations, constraining overloads, ...
* \author Carsten Gräser
*/
/**
* \brief Helper to disable constructor as copy and move constructor
*
* \ingroup TypeUtilities
*
* Helper typedef to remove constructor with forwarding reference from
* overload set for copy and move constructor or assignment.
*/
template<class This, class... T>
using disableCopyMove = typename std::enable_if<
(not(std::is_same<This, typename std::tuple_element<0, std::tuple<typename std::decay<T>::type...> >::type >::value)
and not(std::is_base_of<This, typename std::tuple_element<0, std::tuple<typename std::decay<T>::type...> >::type >::value)), int>::type;
/**
* \brief Helper class for tagging priorities.
*
* \ingroup TypeUtilities
*
* When using multiple overloads of a function
* where some are removed from the overload set
* via SFINAE, the remaining overloads may be ambiguous.
* A prototypic example would be a default overload
* that should be used if the others do not apply.
*
* By adding additional arguments of type PriorityTag<k>
* with increasing priority k to all overloads and calling
* the method with PriorityTag<m> where m is larger or equal
* to the maximal used priority, those can be made unambiguous.
*
* In this case the matching overload with highest priority
* will be used. This is achieved by the fact that PriorityTag<k>
* derives from all types PriorityTag<i> with i less than k.
*
* \tparam priority The priority of this tag.
*/
template<std::size_t priority>
struct PriorityTag : public PriorityTag<priority-1>
{};
/**
* \brief Helper class for tagging priorities.
*
* \ingroup TypeUtilities
*
* PriorityTag<0> does not derive from any
* other PriorityTag.
*/
template<>
struct PriorityTag<0>
{};
} // namespace Dune
#endif // DUNE_COMMON_TYPEUTILITIES_HH
|