Skip to content

Commit

Permalink
Merge branch 'layout-mutable-base' into 'master'
Browse files Browse the repository at this point in the history
mutable base

See merge request correaa/boost-multi!1369
  • Loading branch information
correaa committed Mar 6, 2025
2 parents c863aea + e6e6d3d commit 86ecd32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions include/boost/multi/detail/layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ struct extensions_t : boost::multi::detail::tuple_prepend_t<index_extension, typ
constexpr extensions_t(index_extension const& extension, typename layout_t<D-1>::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<D + 1> {
// return extensions_t<D + 1>(tuple(extension, self.base()));
Expand Down Expand Up @@ -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<class Archive> static void serialize(Archive&/*ar*/, unsigned /*version*/) {/*noop*/}

Expand Down Expand Up @@ -353,7 +355,9 @@ template<> struct extensions_t<1> : tuple<multi::index_extension> {
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();}
Expand Down
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -383,7 +384,7 @@ else()
add_test(NAME ${TEST_EXE} COMMAND $<TARGET_FILE:${TEST_EXE}>)
endforeach()

target_link_libraries (${TEST_EXE} PRIVATE TBB::tbb)
# target_link_libraries (serialization.cpp.x PRIVATE Boost::serialization)

endif()
endif()

0 comments on commit 86ecd32

Please sign in to comment.