diff --git a/include/boost/multi/array_ref.hpp b/include/boost/multi/array_ref.hpp index 6092e6c33..24fed122b 100644 --- a/include/boost/multi/array_ref.hpp +++ b/include/boost/multi/array_ref.hpp @@ -1851,13 +1851,13 @@ struct const_subarray : array_types { } template - auto serialize(Archive& arxiv, unsigned int version) const { + auto serialize(Archive& arxiv, unsigned int /*version*/) { using AT = multi::archive_traits; - if(version == 0) { - std::for_each(this->begin(), this->end(), [&](reference&& item) {arxiv & AT ::make_nvp("item", std::move(item));}); - } else { - std::for_each(this->elements().begin(), this->elements().end(), [&](element& elem) {arxiv & AT ::make_nvp("elem", elem);}); - } + // if(version == 0) { + // std::for_each(this->begin(), this->end(), [&](reference&& item) {arxiv & AT ::make_nvp("item", std::move(item));}); + // } else { + std::for_each(this->elements().begin(), this->elements().end(), [&](element const& elem) {arxiv & AT ::make_nvp("elem", elem);}); + // } // std::for_each(this->begin(), this->end(), [&](auto&& item) {arxiv & cereal::make_nvp("item", item);}); // std::for_each(this->begin(), this->end(), [&](auto&& item) {arxiv & item ;}); } @@ -2362,13 +2362,13 @@ class subarray : public const_subarray { constexpr auto element_moved() && {return element_moved();} template - auto serialize(Archive& arxiv, unsigned int version) { + auto serialize(Archive& arxiv, unsigned int /*version*/) { using AT = multi::archive_traits; - if(version == 0) { - std::for_each(this->begin(), this->end(), [&](typename subarray::reference item) {arxiv & AT ::make_nvp("item", item);}); - } else { + // if(version == 0) { + // std::for_each(this->begin(), this->end(), [&](typename subarray::reference item) {arxiv & AT ::make_nvp("item", item);}); + // } else { std::for_each(this->elements().begin(), this->elements().end(), [&](typename subarray::element& elem) {arxiv & AT ::make_nvp("elem", elem);}); - } + //} // std::for_each(this->begin(), this->end(), [&](auto&& item) {arxiv & cereal::make_nvp("item", item);}); // std::for_each(this->begin(), this->end(), [&](auto&& item) {arxiv & item ;}); } diff --git a/include/boost/multi/detail/layout.hpp b/include/boost/multi/detail/layout.hpp index bf5de5d7d..134aa4eb1 100644 --- a/include/boost/multi/detail/layout.hpp +++ b/include/boost/multi/detail/layout.hpp @@ -157,7 +157,8 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t::extensions_type const& other) : extensions_t(multi::detail::ht_tuple(extension, other.base())) {} - constexpr auto base() const& -> base_ const& {return *this;} // impl_;} + constexpr auto base() const& -> base_ const& { return *this; } // impl_;} + constexpr auto base() & -> base_ & { return *this; } // impl_;} friend constexpr auto operator*(index_extension const& extension, extensions_t const& self) -> extensions_t { // return extensions_t(tuple(extension, self.base())); @@ -292,7 +293,8 @@ template<> struct extensions_t<0> : tuple<> { extensions_t() = default; - constexpr auto base() const -> base_ const& {return *this;} + constexpr auto base() const& -> base_ const& { return *this; } + constexpr auto base() & -> base_ & { return *this; } template static void serialize(Archive&/*ar*/, unsigned /*version*/) {/*noop*/} @@ -353,7 +355,9 @@ template<> struct extensions_t<1> : tuple { constexpr explicit extensions_t(base_ tup) : base_{tup} {} extensions_t() = default; - constexpr auto base() const -> base_ const& {return *this;} + + constexpr auto base() const& -> base_ const& { return *this; } + constexpr auto base() & -> base_ & { return *this; } BOOST_MULTI_HD constexpr auto operator==(extensions_t const& other) const -> bool {return base() == other.base();} // when compiling as cuda code, this needs --expt-relaxed-constexpr BOOST_MULTI_HD constexpr auto operator!=(extensions_t const& other) const -> bool {return base() != other.base();} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a57ee1abc..a3f38ed38 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,6 +24,7 @@ else() option(CMAKE_COMPILE_WARNING_AS_ERROR "Compile warnings as errors" ON) find_package(Boost CONFIG) + find_package(Boost COMPONENTS serialization) if(ENABLE_CUDA) enable_language(CUDA) @@ -339,7 +340,7 @@ else() *.cpp ) - if((NOT Boost_FOUND) AND (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC"))) + if(NOT Boost_FOUND) message(WARNING "Cannot find Boost, Multi library will have a very minimal test. If you want to test the library install Boost.Test, for example please run:\n sudo apt install libboost-test-dev\n sudo dnf install boost-devel") add_executable(main main.cpp) @@ -382,5 +383,8 @@ else() endif() add_test(NAME ${TEST_EXE} COMMAND $) endforeach() + + # target_link_libraries (serialization.cpp.x PRIVATE Boost::serialization) + endif() endif()