diff --git a/btas/varray/varray.h b/btas/varray/varray.h index 22cd89dc..a874b21e 100644 --- a/btas/varray/varray.h +++ b/btas/varray/varray.h @@ -471,9 +471,11 @@ namespace madness { template struct ArchiveLoadImpl> { static inline void load(const Archive& ar, btas::varray& x) { - A allocator; - ar & allocator; - x = btas::varray(allocator); + if constexpr (!std::allocator_traits::is_always_equal::value) { + A allocator; + ar & allocator; + x = btas::varray(allocator); + } typename btas::varray::size_type n{}; ar& n; x.resize(n); @@ -484,7 +486,10 @@ namespace madness { template struct ArchiveStoreImpl> { static inline void store(const Archive& ar, const btas::varray& x) { - ar& x.get_allocator() & x.size(); + if constexpr (!std::allocator_traits::is_always_equal::value) { + ar & x.get_allocator(); + } + ar & x.size(); for (const typename btas::varray::value_type& xi : x) ar& xi; } };