#include <iostream>
#include <array>
using namespace std;
constexpr auto MAX_NUM_RETURNLETS_ALL_CHAN_ONE_SITE = 18;
enum Chan : uint8_t
{
HIGH_NEAR = 0, ///< High gain near channel
HIGH_FAR, ///< High gain far channel
SUPER_LOW, ///< Super low gain channel
NUM_CHANNELS_PER_SITE ///< Total number of channels per site
};
/// Lightweight index into SoA calibrated returns - used during sort/filter to minimize memory traffic
struct SortedIndex
{
Chan gc; ///< The gain channel of the returnlet
std::uint8_t idx; ///< Index within the channel's SoA
std::uint8_t site; ///< The site of this returnlet
};
/// The sort function effectively flattens the multi-channel returns into a single array of returnlets with their associated gain channel.
// struct SortedReturnlet
// {
// CalibratedReturn returnlet; ///< The returnlet to be sorted
// std::uint8_t site; ///< The site of this returnlet
// Chan gc; ///< The gain channel of the returnlet
// };
/// Arrays for sorted indices and returnlets
using SortedIndices = std::array<SortedIndex, MAX_NUM_RETURNLETS_ALL_CHAN_ONE_SITE>;
int main() {
// your code goes here
SortedIndices sorted_indices; // Uninitialized
auto sorted_idx_it = begin(sorted_indices);
auto const end_sorted_indices = end(sorted_indices);
cout << "Array start: " << sorted_indices.data() << endl;
cout << "Iterator addr: " << &(*sorted_idx_it) << endl;
cout << "End - begin: " << end_sorted_indices - sorted_idx_it << endl;
sorted_idx_it++;
cout << "Array index 1: " << sorted_indices.data() + 1 << endl;
cout << "Iterator addr 1: " << &(*sorted_idx_it) << endl;
cout << "End - begin: " << end_sorted_indices - sorted_idx_it << endl;
return 0;
}