32#ifndef MADNESS_WORLD_TYPE_TRAITS_H__INCLUDED
33#define MADNESS_WORLD_TYPE_TRAITS_H__INCLUDED
60 template <
typename Archive,
typename T,
typename Enabler =
void>
61 struct ArchiveSerializeImpl;
63 template <
class Archive,
class T,
typename Enabler =
void>
64 struct ArchiveLoadImpl;
66 template <
class Archive,
class T,
typename Enabler =
void>
67 struct ArchiveStoreImpl;
69 template <
class Archive,
class T,
typename Enabler =
void>
73 template <
typename>
class Future;
107 template <
typename T>
121 template <
typename T>
129 template <
typename T>
137 template <
typename T>
145 template <
typename T>
153 template <
typename T>
162 #define REMFUTURE(T) typename remove_future< T >::type
165 template <
typename T>
171 template <
typename T>
175 template <
typename T>
179 template <
typename T>
183 template <
typename T>
187 template <
typename T>
191 template <
typename T>
196 template <
typename T>
201 template <
typename T>
206 template <
typename T>
struct is_function_pointer<
T,
std::enable_if_t<std::is_function<typename std::remove_pointer<T>::type>::value>> :
public std::true_type {};
213 template <
typename T>
struct is_any_function_pointer<
T,
std::enable_if_t<std::is_member_function_pointer<T>::value || is_function_pointer_v<T>>> :
public std::true_type {};
217 template <
typename T>
220 template <
typename T>
226 template <
typename T>
229 std::is_arithmetic<T>::value || \
230 std::is_function<T>::value || \
231 is_any_function_pointer_v<T> || \
232 (std::is_standard_layout<T>::value && std::is_trivial<T>::value && !std::is_pointer<T>::value);
236 template <
typename T>
240 namespace is_ostreammable_ns {
242 template <
typename To,
typename From>
using left_shift =
decltype(std::declval<To>() << std::declval<From>());
245 template <
typename T>
struct impl :
public meta::disjunction<meta::is_detected_exact<std::ostream&, left_shift, std::ostream&, std::add_const_t<std::add_lvalue_reference_t<T>>>,
246 meta::is_detected_exact<std::ostream&, left_shift_in_ns_madness_operators, std::ostream&, std::add_const_t<std::add_lvalue_reference_t<T>>>> {};
251 template <
typename T>
258 namespace is_istreammable_ns {
260 template <
typename From,
typename To>
using right_shift =
decltype(std::declval<From>() >> std::declval<To>());
263 template <
typename T>
struct impl :
public meta::disjunction<meta::is_detected_exact<std::istream&, right_shift, std::istream&, std::add_lvalue_reference_t<T>>,
264 meta::is_detected_exact<std::istream&, right_shift_in_ns_madness_operators, std::istream&, std::add_lvalue_reference_t<T>>> {};
270 template <
typename T>
277 template <
typename T>
constexpr bool is_iostreammable_v = is_istreammable_v<T> && is_ostreammable_v<T>;
280 std::is_arithmetic<T>::value || \
281 std::is_same<std::nullptr_t, typename std::remove_cv<T>::type>::value || \
282 is_any_function_pointer_v<T> || \
283 std::is_function<T>::value;
288 template<
typename T,
typename Archive>
294 template<
typename T,
typename Archive>
299 template<
typename T,
typename Archive>
304 template<
typename T,
typename Archive>
309 template<
typename T,
typename Archive>
314 template<
typename T,
typename Archive>
319 template<
typename T,
typename Archive>
324 template<
typename T,
typename Archive>
329 template<
typename T,
typename Archive,
typename = std::enable_if_t<std::is_po
inter_v<T>>>
334 template<
typename T,
typename Archive,
typename = std::enable_if_t<!std::is_po
inter_v<T>>>
339 template<
typename T,
typename Archive>
344 template<
typename T,
typename Archive,
typename = std::enable_if_t<std::is_po
inter_v<T>>>
352 template <
typename T,
typename Archive>
360 template <
typename T,
typename Archive>
368 template <
typename T,
typename Archive>
376 template <
typename T,
typename Archive>
377 inline constexpr bool has_nonmember_load_v = madness::meta::is_detected_v<madness::has_nonmember_load_t,T,Archive>;
384 template <
typename T,
typename Archive>
385 inline constexpr bool has_nonmember_store_v = madness::meta::is_detected_v<madness::has_nonmember_store_t,T,Archive>;
387 template <
typename T,
typename Archive>
395 template <
typename T,
typename Archive>
403 template <
typename T,
typename Archive>
406 template <
typename T,
typename Archive>
414 template <
typename T,
typename Archive>
422 template <
typename T,
typename Archive>
430 template <
typename T,
typename Archive>
438 template <
typename T,
typename Archive>
446 template <
typename T,
typename Archive>
449 template <
typename Archive,
typename T,
typename Enabler =
void>
459 template <
typename Archive,
typename T>
464 template <
typename Archive,
typename T>
467 template <
typename Archive,
typename T>
473 class BaseInputArchive;
474 class BaseOutputArchive;
475 class BinaryFstreamOutputArchive;
476 class BinaryFstreamInputArchive;
477 class BufferOutputArchive;
478 class BufferInputArchive;
479 class VectorOutputArchive;
480 class VectorInputArchive;
481 class TextFstreamOutputArchive;
482 class TextFstreamInputArchive;
483 class MPIRawOutputArchive;
484 class MPIRawInputArchive;
485 class MPIOutputArchive;
486 class MPIInputArchive;
487 class ContainerRecordInputArchive;
488 class ContainerRecordOutputArchive;
489 template <
class localarchiveT>
490 class ParallelOutputArchive;
491 template <
class localarchiveT>
492 class ParallelInputArchive;
493 template <
typename T>
504 template <
typename T,
typename Enabler =
void>
507 template <
typename T>
510 template <
typename T>
511 inline constexpr bool is_archive_v = meta::is_detected_v<is_archive_defined_t,T>;
521 template <
typename T,
typename Enabler =
void>
524 template <
typename T>
527 template <
typename T>
537 template <
typename T,
typename Enabler =
void>
540 template <
typename T>
543 template <
typename T>
546 template <
typename T>
548 template <
typename T>
550 template <
typename T>
552 template <
typename T>
554 template <
typename T>
556 template <
typename T>
560 template <
typename T>
561 struct is_default_serializable_helper<archive::TextFstreamOutputArchive,
T, std::enable_if_t<is_iostreammable_v<T> || std::is_function_v<T> || is_any_function_pointer_v<T>>> : std::true_type {};
562 template <
typename T>
563 struct is_default_serializable_helper<archive::TextFstreamInputArchive,
T, std::enable_if_t<is_iostreammable_v<T> || is_any_function_pointer_v<T>>> : std::true_type {};
564 template <
typename T>
566 template <
typename T>
568 template <
typename T>
570 template <
typename T>
572 template <
typename T>
574 template <
typename T>
576 template <
typename T,
class localarchiveT>
578 template <
typename T,
class localarchiveT>
580 template <
typename Archive,
typename T>
581 struct is_default_serializable_helper<Archive, archive::archive_array<T>, std::enable_if_t<is_default_serializable_helper<Archive,T>::value>> : std::true_type {};
584 struct is_archive<archive::BinaryFstreamOutputArchive> : std::true_type {};
586 struct is_archive<archive::BinaryFstreamInputArchive> : std::true_type {};
588 struct is_archive<archive::BufferOutputArchive> : std::true_type {};
590 struct is_archive<archive::BufferInputArchive> : std::true_type {};
592 struct is_archive<archive::VectorOutputArchive> : std::true_type {};
594 struct is_archive<archive::VectorInputArchive> : std::true_type {};
596 struct is_archive<archive::TextFstreamOutputArchive> : std::true_type {};
598 struct is_archive<archive::TextFstreamInputArchive> : std::true_type {};
600 struct is_archive<archive::MPIRawOutputArchive> : std::true_type {};
602 struct is_archive<archive::MPIRawInputArchive> : std::true_type {};
604 struct is_archive<archive::MPIOutputArchive> : std::true_type {};
606 struct is_archive<archive::MPIInputArchive> : std::true_type {};
608 struct is_archive<archive::ContainerRecordOutputArchive> : std::true_type {};
610 struct is_archive<archive::ContainerRecordInputArchive> : std::true_type {};
611 template <
class localarchiveT>
612 struct is_archive<archive::ParallelOutputArchive<localarchiveT> > : std::true_type {};
613 template <
class localarchiveT>
614 struct is_archive<archive::ParallelInputArchive<localarchiveT> > : std::true_type {};
630 template <
class localarchiveT>
647 template <
class localarchiveT>
648 struct is_input_archive<archive::ParallelInputArchive<localarchiveT> > : std::true_type {};
653 template <
typename Archive,
typename T>
655 has_nonmember_serialize_v<T, Archive> ||
656 ((has_nonmember_load_v<T, Archive> || has_nonmember_wrap_load_v<T, Archive>) && is_input_archive_v<Archive> && !has_freestanding_default_serialize_v<T, Archive>) ||
657 ((has_nonmember_store_v<T, Archive> || has_nonmember_wrap_store_v<T, Archive>) && is_output_archive_v<Archive> && !has_freestanding_default_serialize_v<T, Archive>));
659 template <
typename Archive,
typename T>
667 template <
typename Archive,
typename T>
668 inline constexpr bool is_serializable_v = is_archive_v<Archive> && (is_default_serializable_v<Archive, T> ||
669 is_user_serializable_v<Archive,T>);
671 template <
typename Archive,
typename T>
674 template <
typename Archive,
typename T>
680 template <
typename Archive,
typename Enabler =
void>
690 template <
typename Archive>
703#define REMCONST(TYPE) typename std::remove_const< TYPE >::type
704#define MEMFUN_RETURNT(MEMFUN) typename madness::detail::memfunc_traits< MEMFUN >::result_type
A future is a possibly yet unevaluated value.
Definition future.h:373
Definition type_traits.h:53
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:34
static double u(double r, double c)
Definition he.cc:20
decltype(madness::operators::operator<<(std::declval< From >(), std::declval< To >())) right_shift_in_ns_madness_operators
Definition type_traits.h:261
decltype(std::declval< From >() > > std::declval< To >()) right_shift
Definition type_traits.h:260
decltype(madness::operators::operator<<(std::declval< To >(), std::declval< From >())) left_shift_in_ns_madness_operators
Definition type_traits.h:243
decltype(std::declval< To >()<< std::declval< From >()) left_shift
Definition type_traits.h:242
std::ostream & operator<<(std::ostream &s, const std::array< T, N > &a)
Output std::array to stream for human consumption.
Definition array_addons.h:59
std::ostream & operator>>(std::ostream &, __x &)
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
constexpr bool has_nonmember_load_and_store_v
Definition type_traits.h:388
typename future_to_ref< T >::type future_to_ref_t
Definition type_traits.h:192
constexpr bool is_serializable_v
Definition type_traits.h:668
typename remove_fcvr< T >::type remove_fcvr_t
Definition type_traits.h:202
constexpr bool is_always_serializable
Definition type_traits.h:279
decltype(madness::archive::ArchiveImpl< Archive, T >::wrap_load(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_wrap_load_t
Definition type_traits.h:315
decltype(std::declval< T & >().serialize(std::declval< Archive & >())) has_member_serialize_t
Definition type_traits.h:289
constexpr bool is_function_pointer_v
Definition type_traits.h:207
constexpr bool is_istreammable_v
Shortcut for is_istreammable<T>::value.
Definition type_traits.h:274
decltype(serialize(std::declval< Archive & >(), std::declval< T & >(), 1u)) has_freestanding_serialize_with_size_t
Definition type_traits.h:330
constexpr bool has_nonmember_wrap_load_v
Definition type_traits.h:396
decltype(serialize(std::declval< Archive & >(), std::declval< T & >())) has_freestanding_serialize_t
Definition type_traits.h:325
constexpr bool is_default_serializable_v< Archive, const T >
Definition type_traits.h:468
constexpr bool is_user_serializable_v< Archive, const T >
Definition type_traits.h:660
constexpr bool has_member_serialize_v
Definition type_traits.h:353
constexpr bool has_freestanding_serialize_with_size_v
Definition type_traits.h:423
constexpr bool has_nonmember_wrap_load_and_store_v
Definition type_traits.h:407
decltype(default_serialize(std::declval< Archive & >(), std::declval< const T & >(), 1u)) has_freestanding_default_serialize_with_size_t
Definition type_traits.h:345
constexpr bool has_freestanding_serialize_with_version_v
Definition type_traits.h:431
constexpr bool has_freestanding_serialize_v
Definition type_traits.h:415
decltype(madness::archive::ArchiveSerializeImpl< Archive, T >::serialize(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_serialize_t
Definition type_traits.h:300
constexpr bool is_iostreammable_v
providing automatic support for serializing to/from std streams requires bidirectional streammability
Definition type_traits.h:277
constexpr bool is_user_serializable_v
Definition type_traits.h:654
typename is_input_archive< std::remove_reference_t< std::remove_cv_t< T > > >::type is_input_archive_defined_t
Definition type_traits.h:525
decltype(madness::archive::ArchiveLoadImpl< Archive, T >::load(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_load_t
Definition type_traits.h:305
constexpr bool is_ostreammable_v
Shortcut for is_ostreammable<T>::value.
Definition type_traits.h:255
typename is_archive< std::remove_reference_t< std::remove_cv_t< T > > >::type is_archive_defined_t
Definition type_traits.h:508
typename is_output_archive< std::remove_reference_t< std::remove_cv_t< T > > >::type is_output_archive_defined_t
Definition type_traits.h:541
constexpr bool is_default_serializable_v
Definition type_traits.h:465
decltype(default_serialize(std::declval< Archive & >(), std::declval< T & >())) has_freestanding_default_serialize_t
Definition type_traits.h:340
constexpr bool is_output_archive_v
Definition type_traits.h:544
constexpr bool has_nonmember_wrap_store_v
Definition type_traits.h:404
constexpr bool has_freestanding_default_serialize_v
Definition type_traits.h:439
constexpr bool is_any_function_pointer_v
Definition type_traits.h:214
decltype(serialize(std::declval< Archive & >(), std::declval< T & >(), 0u)) has_freestanding_serialize_with_version_t
Definition type_traits.h:335
constexpr bool is_input_archive_v
Definition type_traits.h:528
constexpr bool has_member_serialize_with_version_v
Definition type_traits.h:361
std::string type(const PairType &n)
Definition PNOParameters.h:18
decltype(madness::archive::ArchiveStoreImpl< Archive, T >::store(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_store_t
Definition type_traits.h:310
constexpr bool has_nonmember_serialize_v
Definition type_traits.h:369
decltype(std::declval< T & >().serialize(std::declval< Archive & >(), 0u)) has_member_serialize_with_version_t
Definition type_traits.h:295
constexpr bool is_serializable_v< Archive, const T >
Definition type_traits.h:672
constexpr bool has_nonmember_store_v
Definition type_traits.h:385
constexpr bool is_archive_v
Definition type_traits.h:511
constexpr const bool is_text_archive_v
is_text_archive_v is a shorthand for is_text_archive<A>::value
Definition type_traits.h:691
decltype(madness::archive::ArchiveImpl< Archive, T >::wrap_store(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_wrap_store_t
Definition type_traits.h:320
constexpr bool has_nonmember_load_v
Definition type_traits.h:377
typename remove_future< T >::type remove_future_t
C++11 version of REMFUTURE.
Definition type_traits.h:166
constexpr bool is_trivially_copyable_v
Definition type_traits.h:221
constexpr bool has_freestanding_default_serialize_with_size_v
Definition type_traits.h:447
constexpr bool is_trivially_serializable_v
Definition type_traits.h:237
Future< T > type
Type with Future added.
Definition type_traits.h:101
maps type T to Future<T>.
Definition type_traits.h:88
Future< T > type
Type with Future added.
Definition type_traits.h:90
static const Archive & wrap_load(const Archive &ar, const T &t)
Load an object sandwiched between its preamble and postamble.
Definition archive.h:747
static const Archive & wrap_store(const Archive &ar, const T &t)
Store an object sandwiched between its preamble and postamble.
Definition archive.h:733
static void load(const A &ar, const U &t)
Load an object.
Definition archive.h:678
static void serialize(const Archive &ar, T &t)
Serializes the type.
Definition archive.h:560
static std::enable_if_t< is_output_archive_v< A > &&!std::is_function< U >::value &&(has_member_serialize_v< U, A >||has_nonmember_serialize_v< U, A >||has_freestanding_serialize_v< U, A >||has_freestanding_default_serialize_v< U, A >), void > store(const A &ar, const U &t)
Definition archive.h:621
T & type
Definition type_traits.h:177
T & type
Definition type_traits.h:181
T & type
Definition type_traits.h:185
T & type
Definition type_traits.h:189
Definition type_traits.h:172
T type
Definition type_traits.h:173
is true type if T is a pointer to free or member function
Definition type_traits.h:212
Checks if T is an archive type.
Definition type_traits.h:505
Definition type_traits.h:450
is std::true_type if T can be serialized to Archive without specialized serialize() method
Definition type_traits.h:460
static constexpr bool value
Definition type_traits.h:461
is true type if T is a pointer to a free function
Definition type_traits.h:205
test if a type is a future.
Definition type_traits.h:79
Definition type_traits.h:264
Definition type_traits.h:271
Definition type_traits.h:246
Definition type_traits.h:252
Checks if T is an output archive type.
Definition type_traits.h:538
Definition type_traits.h:675
This trait types tests if Archive is a text archive.
Definition type_traits.h:681
trait for trivial (=bitwise) copyability of T, defaults to std::is_trivially_copyable<T> but can be s...
Definition type_traits.h:218
Definition type_traits.h:227
static const bool value
Definition type_traits.h:228
Definition type_traits.h:197
remove_future< typenamestd::remove_cv< typenamestd::remove_reference< T >::type >::type >::type type
Definition type_traits.h:199
T type
Type with Future removed.
Definition type_traits.h:124
T & type
Type with Future removed.
Definition type_traits.h:140
T && type
Type with Future removed.
Definition type_traits.h:148
const T type
Type with Future removed.
Definition type_traits.h:132
const T & type
Type with Future removed.
Definition type_traits.h:156
maps Future<T> to T.
Definition type_traits.h:108
T type
Type with Future removed.
Definition type_traits.h:110