#include <iostream>
#include <array>

// related: https://stackoverflow.com/questions/17388317/c11-implicit-conversion-from-initialization-list-to-array-parameter

template<int V>
struct Cls {int val(){return V;} };



template <int V>
auto make(std::array<const size_t, V> shape) -> Cls<V>{
  return Cls<V>();
}

// unfortunately, this doesn't work either:
// template <int V>
// constexpr size_t arr_len(std::array<const size_t, V>){return V;}
// template <int V>
// auto make(std::array<const size_t, V> shape) -> Cls<arr_len(shape)>{
//   return Cls<arr_len(shape)>();
// }


int main(int argc, char const *argv[])
{
  // I would like to write the following and the compiler should figure out V=2
  // auto t0 = make({2, 3}); // doesn't work
  // auto t0 = make(2, 3); // would be also ok
  auto t1 = make<2>({2, 3}); // does work but need the information twice
  std::cout << t1.val() << std::endl;

  return 0;
}