Add dereferenceMaybe()

consistent_macro_prefix
Martchus 4 years ago
parent 97aac2424a
commit 236309971d
  1. 10
      misc/traits.h

@ -108,6 +108,16 @@ CPP_UTILITIES_TRAITS_DEFINE_TYPE_CHECK(IsIteratable,
// operator*
void(*begin(std::declval<T &>())));
template <typename T> T &dereferenceMaybe(T &x)
{
return x;
}
template <typename T> T &dereferenceMaybe(T *x)
{
return *x;
}
} // namespace Traits
#endif // CPP_UTILITIES_TRAITS_H

Loading…
Cancel
Save