// Distributed under the MIT License (MIT) (see accompanying LICENSE file) #pragma once #include "Range.h" #include #include #include // Utilities to work with one-dimensional, statically bound arrays. Code relying on those utilities should work without // modifications with fixed-sized arrays (currently used in ImGui) and with standard arrays. namespace Utilities { //==================================================================================================== // Helper functions //==================================================================================================== // Function to determine number of elements in fixed size array. template constexpr std::size_t GetArraySize(const T(&)[N]) { return N; } // Function to determine number of elements in std array. template constexpr std::size_t GetArraySize(const std::array&) { return N; } //==================================================================================================== // Traits //==================================================================================================== template struct ArraySize; // Struct to determine number of elements in fixed size array. template struct ArraySize : std::extent { }; // Struct to determine number of elements in std array. template struct ArraySize> : std::tuple_size> { }; //==================================================================================================== // Ranges //==================================================================================================== // Array indices range. Limited by 0 and array size. template using TArrayIndexRange = TBoundedRange::value>; }