Skip to content

Instantly share code, notes, and snippets.

@Gnomorian
Created October 4, 2023 21:37
Show Gist options
  • Save Gnomorian/ff8e539a13bb92701b22055d06ffa949 to your computer and use it in GitHub Desktop.
Save Gnomorian/ff8e539a13bb92701b22055d06ffa949 to your computer and use it in GitHub Desktop.
make_array implementation
#include <iostream>
#include <array>
// simple template method that creates a std::array
template<typename...T>
auto make_array(T...data) -> std::array<std::tuple_element_t<0, std::tuple<T...>>, sizeof...(data)>
{
return {data...};
}
int main()
{
auto arr{ make_array('a', 'b')};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment