20 #ifndef GEOS_DATAREPOSITORY_DEFAULTVALUE_HPP_
21 #define GEOS_DATAREPOSITORY_DEFAULTVALUE_HPP_
25 #include "codingUtilities/traits.hpp"
29 namespace dataRepository
39 template<
typename T >
43 static constexpr
bool value = std::is_arithmetic< T > ::value ||
44 std::is_same< T, string >::value ||
45 std::is_same< T, Path >::value ||
46 traits::is_tensorT< T > ||
47 std::is_enum< T >::value;
57 template<
typename T,
typename ENABLE=
void >
61 static constexpr
bool has_default_value =
false;
64 using value_type = void;
75 template<
typename T >
76 struct Helper< T, std::enable_if_t< is_defaultable< T >::value > >
79 static constexpr
bool has_default_value =
true;
85 value_type value = value_type();
97 template<
typename T >
98 struct Helper< T, std::enable_if_t< traits::HasAlias_value_type< T > &&
99 is_defaultable< typename T::value_type >::value &&
100 !traits::is_string< T > &&
101 !traits::is_tensorT< T > > >
104 static constexpr
bool has_default_value =
true;
107 using value_type =
typename T::value_type;
110 value_type value = value_type();
113 template<
typename T >
114 std::enable_if_t< !Helper< T >::has_default_value, std::ostream & >
120 template<
typename T >
121 std::enable_if_t< Helper< T >::has_default_value, std::ostream & >
122 operator<<( std::ostream & stream, Helper< T >
const & value )
124 return stream << value.value;
133 template<
typename T >
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
std::ostream & operator<<(std::ostream &os, PlotLevel const &plotLevel)
Writes a plot level to a stream.
internal::Helper< T > DefaultValue
A templated alias to hold default values.