10 #ifndef HERD_DEFAULTVALUES_H_
11 #define HERD_DEFAULTVALUES_H_
23 #define DEFAULT_INIT(x) x{defaultValue<decltype(x)>}
24 #define SET_TO_DEFAULT(x) x = DefaultValue(x)
32 constexpr
typename std::enable_if_t<std::is_arithmetic<T>::value, T> defaultValue = std::numeric_limits<T>::max();
35 template <>
const std::string defaultValue<std::string> =
"";
44 template <> constexpr Vec3D defaultValue<Vec3D> = Vec3D();
47 template <
class T,
size_t N> constexpr std::array<T, N> make_array(
const T &v) {
48 std::array<T, N> ret{};
49 for (
auto &val : ret) {
56 template <
class T,
size_t N>
57 constexpr std::array<T, N> defaultValue<std::array<T, N>> = make_array<T, N>(defaultValue<T>);
60 template <
typename T> constexpr CooArray<T> defaultValue<CooArray<T>> = CooArray<T>(make_array<T, 3>(defaultValue<T>));
63 template <
typename T,
typename U>
64 constexpr std::pair<T, U> defaultValue<std::pair<T, U>> = std::make_pair(defaultValue<T>, defaultValue<U>);
67 template <
typename T> constexpr
AxesArray<T> getDefaultAxesArrayValue() {
77 template <
typename T> constexpr
AxesArray<T> defaultValue<AxesArray<T>> = _Private::getDefaultAxesArrayValue<T>();
80 template <
int N> constexpr std::bitset<N> defaultValue<std::bitset<N>> = std::bitset<N>();
83 template <
typename T> constexpr T DefaultValue(
const T &x) {
84 return defaultValue<std::remove_const_t<std::remove_reference_t<decltype(x)>>>;