Skip to content

Commit

Permalink
Archive conversion for tables
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sparus committed Feb 22, 2024
1 parent 71b1b60 commit 5344863
Show file tree
Hide file tree
Showing 4 changed files with 993 additions and 146 deletions.
19 changes: 19 additions & 0 deletions immer/extra/archive/champ/archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,24 @@ auto transform_archive(const container_archive_load<
};
}

template <typename T,
typename KeyFn,
typename Hash,
typename Equal,
typename MemoryPolicy,
immer::detail::hamts::bits_t B,
class F>
auto transform_archive(
const container_archive_load<
immer::table<T, KeyFn, Hash, Equal, MemoryPolicy, B>>& ar,
F&& func)
{
using U = std::decay_t<decltype(func(std::declval<T>()))>;
using new_table_t = immer::table<U, KeyFn, Hash, Equal, MemoryPolicy, B>;
return container_archive_load<new_table_t>{
.nodes = transform(ar.nodes, func),
};
}

} // namespace champ
} // namespace immer::archive
Loading

0 comments on commit 5344863

Please sign in to comment.