C++ Logo


Advanced search

Re: [std-proposals] Named auto

From: Sébastien Bini <sebastien.bini_at_[hidden]>
Date: Wed, 28 Sep 2022 16:06:31 +0200
How about a syntax similar to that of parameters then?

template <class T> T var = foo();
template <class K, class V> std::pair<K const, V>& kv = *map.begin(); // or
[k, v]?
template <std::copyable T, auto I> std::array<T, I> arr = getArr();
template <std::size_t... I> [[maybe_unused]] std::index_sequence<I...> seq
= std::index_sequence_for<Args...>();

Then we don't need to reinvent the syntax for parameters.

Received on 2022-09-28 14:06:43