In the MRE https://godbolt.org/z/jdjPzdGeo, is there a way to return an iterator for c type arrays in Func like what you see with std::array in Func2 and Func3? IDK what the return type would be.
Also, is there a way to make Func constexpr like in Func2?
Edit: Add the code here
#include <array>
std::pair<int*, std::size_t>
Func() noexcept
{
// why does constexpr instead of static not work?
static int arr[] = {1, 2};
return { arr, std::size(arr) };
}
constexpr std::pair<std::array<int,2>::const_iterator, std::array<int,2>::const_iterator>
Func2() noexcept
{
constexpr std::array<int, 2> arr {{1, 2}};
return { std::cbegin(arr), std::cend(arr) };
}
std::pair<std::array<int,2>::const_iterator, std::array<int,2>::const_iterator>
Func3() noexcept
{
static std::array<int, 2> arr {{1, 2}};
return { std::cbegin(arr), std::cend(arr) };
}
int main()
{
Func();
Func2();
Func3();
}