13 template<
typename T,
typename Allocator = std::allocator<std::decay_t<T>>>
14 using Buffer = TTG_IMPL_NS::Buffer<T, Allocator>;
20 template<
typename T,
typename A>
24 template<
typename T,
typename A>
29 template<
typename T,
typename A>
41 template<
typename T,
typename Enabler =
void>
58 #ifdef TTG_SERIALIZATION_SUPPORTS_MADNESS
59 #include <madness/world/buffer_archive.h>
64 struct BufferVisitorArchive :
public madness::archive::BaseOutputArchive {
69 template<
typename _Fn>
70 BufferVisitorArchive(_Fn&& fn)
81 template <
typename T,
typename Allocator>
84 for (std::size_t i = 0; i < n; ++i) {
90 void store(
const T* t,
long n)
const {
95 void open(std::size_t ) {}
105 std::size_t
size()
const {
111 template<
typename Fn>
112 BufferVisitorArchive(
Fn&&) -> BufferVisitorArchive<Fn>;
115 template <
typename Fn>
116 struct is_archive<archive::BufferVisitorArchive<Fn>> : std::true_type {};
118 template <
typename Fn>
119 struct is_output_archive<archive::BufferVisitorArchive<Fn>> : std::true_type {};
121 template <
typename Fn,
typename T>
122 struct is_default_serializable_helper<archive::BufferVisitorArchive<Fn>, T,
123 std::enable_if_t<is_trivially_serializable<T>::value>>
126 template <
typename Fn,
typename T,
typename Allocator>
127 struct is_default_serializable_helper<archive::BufferVisitorArchive<Fn>,
ttg::Buffer<T, Allocator>>
132 template<
typename T,
typename Fn>
133 requires(madness::is_serializable_v<madness::archive::BufferVisitorArchive<Fn>, std::decay<T>>)
135 madness::archive::BufferVisitorArchive ar(std::forward<Fn>(fn));
140 using buffer_apply_dummy_fn = decltype([]<
typename T,
typename A>(
const ttg::Buffer<T, A>&){});
143 struct has_buffer_apply_helper<T, std::enable_if_t<madness::is_serializable_v<madness::archive::BufferVisitorArchive<buffer_apply_dummy_fn>, std::decay_t<T>>>>
152 template<
typename T,
typename Fn>
154 static_assert(ttg::meta::is_void_v<Fn>,
"Types using ttg::Buffer must be MADNESS serializable.");
std::integral_constant< bool,(Flags &const_) !=0 > is_const
constexpr const bool has_buffer_apply_v
void buffer_apply(T &&t, Fn &&fn)
top-level TTG namespace contains runtime-neutral functionality
int size(World world=default_execution_context())
N.B. contains values of F_n and F_{n-1}.