From 0849461e056dac5e08ffc8dbc9b309d3ad065231 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Fri, 1 Dec 2023 02:23:48 +0000 Subject: [PATCH 1/2] Add iterator traits to emp::array iterator --- include/emp/base/array.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/emp/base/array.hpp b/include/emp/base/array.hpp index 22916c195e..5a13341d6a 100644 --- a/include/emp/base/array.hpp +++ b/include/emp/base/array.hpp @@ -46,6 +46,13 @@ namespace emp { using this_t = array_iterator; using array_t = ARRAY_T; + // Iterator traits + using iterator_category = typename std::iterator_traits::iterator_category; + using value_type = typename std::iterator_traits::value_type; + using difference_type = typename std::iterator_traits::difference_type; + using pointer = typename std::iterator_traits::pointer; + using reference = typename std::iterator_traits::reference; + ITERATOR_T it; const array_t * arr_ptr { nullptr }; // Which array was iterator created from? From 6ad7a5de0184305c886bd8fd428bdc06751f0900 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Thu, 30 Nov 2023 23:09:26 -0500 Subject: [PATCH 2/2] Switch span constructor for opt mode compat --- include/emp/bits/Bits_Data.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/emp/bits/Bits_Data.hpp b/include/emp/bits/Bits_Data.hpp index 83766d2acb..e8fe4a0a03 100644 --- a/include/emp/bits/Bits_Data.hpp +++ b/include/emp/bits/Bits_Data.hpp @@ -196,8 +196,8 @@ namespace emp { } } - [[nodiscard]] auto AsSpan() { return std::span(bits.data()); } - [[nodiscard]] auto AsSpan() const { return std::span(bits.data()); } + [[nodiscard]] auto AsSpan() { return std::span(bits.data(), MAX_FIELDS); } + [[nodiscard]] auto AsSpan() const { return std::span(bits.data(), MAX_FIELDS); } [[nodiscard]] bool OK() const { return true; } // Nothing to check yet.