Skip to content

Instantly share code, notes, and snippets.

@terngkub
Created August 14, 2018 15:13
Show Gist options
  • Select an option

  • Save terngkub/958a80a145a5bd27fea0437714b747f9 to your computer and use it in GitHub Desktop.

Select an option

Save terngkub/958a80a145a5bd27fea0437714b747f9 to your computer and use it in GitHub Desktop.
template <typename D = void, typename... T>
constexpr auto make_array(T &&... t) -> std::array<std::conditional_t<std::is_void<D>::value, std::common_type_t<T...>, D>, sizeof...(T)>
{
return {{std::forward<T>(t)...}};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment