/usr/include/dune/common/std/type_traits.hh is in libdune-common-dev 2.4.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 | #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
#define DUNE_COMMON_STD_TYPE_TRAITS_HH
#include <type_traits>
namespace Dune
{
namespace Std
{
// to_false_type
// -------------
/** \class to_false_type
*
* \brief template mapping a type to <tt>std::false_type</tt>
*
* \tparam T Some type
*
* 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
* {
* 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 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 to_false_type: replace <tt>false</tt> by
* <tt>to_false_type<T>::value</tt>, like this:
* \code
* template<typename T>
* struct Traits
* {
* static_assert(Std::to_false_type<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 to_false_type for template
* parameter T, the compiler cannot trigger static_assert() until the type
* of T is known, that is, until Traits<T> is instantiated.
*/
template< typename T >
struct to_false_type : public std::false_type {};
// to_true_type
// ------------
/** \class to_true_type
*
* \brief template mapping a type to <tt>std::true_type</tt>
*
* \tparam T Some type
*
* \note This class exists mostly for consistency with to_false_type.
*/
template< typename T >
struct to_true_type : public std::true_type {};
} // namespace Std
} // namespace Dune
#endif // #ifndef DUNE_COMMON_STD_TYPE_TRAITS_HH
|