From 0980e0d90dc518eb772d7713163d890c8e6e4563 Mon Sep 17 00:00:00 2001 From: Lawrence Murray Date: Mon, 28 Oct 2024 00:29:05 +0700 Subject: [PATCH] Workaround for Xcode (version 15+?) compile errors when using std::sort(). --- .circleci/config.yml | 2 +- libraries/Standard/src/primitive/primitive.birch | 2 +- numbirch/numbirch/array/ArrayIterator.hpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b9d46eea4..928a13534 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ executors: mac: macos: - xcode: 15.4.0 + xcode: 16.0.0 environment: CODENAME: mac OMP_NUM_THREADS: 4 diff --git a/libraries/Standard/src/primitive/primitive.birch b/libraries/Standard/src/primitive/primitive.birch index 10ef2b40a..518f797ae 100644 --- a/libraries/Standard/src/primitive/primitive.birch +++ b/libraries/Standard/src/primitive/primitive.birch @@ -444,7 +444,7 @@ function is_sorted(x:Type[_]) -> Boolean { function sort(x:Type[_]) -> Type[_] { let y <- x; cpp{{ - std::sort(y.begin(), y.end()); + std::stable_sort(y.begin(), y.end()); }} return y; } diff --git a/numbirch/numbirch/array/ArrayIterator.hpp b/numbirch/numbirch/array/ArrayIterator.hpp index 42b9fa827..34e9129e5 100644 --- a/numbirch/numbirch/array/ArrayIterator.hpp +++ b/numbirch/numbirch/array/ArrayIterator.hpp @@ -23,6 +23,10 @@ class ArrayIterator { using const_reference = const T&; using iterator_category = std::random_access_iterator_tag; + ArrayIterator() : buf(nullptr), shp(), pos(0) { + // + } + explicit ArrayIterator(T* buf, const ArrayShape shp, const difference_type pos) : buf(buf),