32 #ifndef MADNESS_WORLD_TYPE_TRAITS_H__INCLUDED
33 #define MADNESS_WORLD_TYPE_TRAITS_H__INCLUDED
46 #include <type_traits>
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 {};
219 template <
typename T>
222 std::is_arithmetic<T>::value || \
223 std::is_function<T>::value || \
224 is_any_function_pointer_v<T> || \
225 (std::is_standard_layout<T>::value && std::is_trivial<T>::value && !std::is_pointer<T>::value);
229 template <
typename T>
233 namespace is_ostreammable_ns {
235 template <
typename To,
typename From>
using left_shift = decltype(std::declval<To>() << std::declval<From>());
238 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>>>,
239 meta::is_detected_exact<std::ostream&, left_shift_in_ns_madness_operators, std::ostream&, std::add_const_t<std::add_lvalue_reference_t<T>>>> {};
244 template <
typename T>
251 namespace is_istreammable_ns {
253 template <
typename From,
typename To>
using right_shift = decltype(std::declval<From>() >> std::declval<To>());
256 template <
typename T>
struct impl :
public meta::disjunction<meta::is_detected_exact<std::istream&, right_shift, std::istream&, std::add_lvalue_reference_t<T>>,
257 meta::is_detected_exact<std::istream&, right_shift_in_ns_madness_operators, std::istream&, std::add_lvalue_reference_t<T>>> {};
263 template <
typename T>
270 template <
typename T> constexpr
bool is_iostreammable_v = is_istreammable_v<T> && is_ostreammable_v<T>;
273 std::is_arithmetic<T>::value ||
\
275 is_any_function_pointer_v<T> || \
276 std::is_function<T>::value;
281 template<
typename T,
typename Archive>
287 template<
typename T,
typename Archive>
292 template<
typename T,
typename Archive>
297 template<
typename T,
typename Archive>
302 template<
typename T,
typename Archive>
307 template<
typename T,
typename Archive>
312 template<
typename T,
typename Archive>
317 template<
typename T,
typename Archive>
322 template<
typename T,
typename Archive,
typename = std::enable_if_t<std::is_po
inter_v<T>>>
327 template<
typename T,
typename Archive,
typename = std::enable_if_t<!std::is_po
inter_v<T>>>
332 template<
typename T,
typename Archive>
337 template<
typename T,
typename Archive,
typename = std::enable_if_t<std::is_po
inter_v<T>>>
345 template <
typename T,
typename Archive>
353 template <
typename T,
typename Archive>
361 template <
typename T,
typename Archive>
369 template <
typename T,
typename Archive>
370 inline constexpr
bool has_nonmember_load_v = madness::meta::is_detected_v<madness::has_nonmember_load_t,T,Archive>;
377 template <
typename T,
typename Archive>
378 inline constexpr
bool has_nonmember_store_v = madness::meta::is_detected_v<madness::has_nonmember_store_t,T,Archive>;
380 template <
typename T,
typename Archive>
388 template <
typename T,
typename Archive>
396 template <
typename T,
typename Archive>
399 template <
typename T,
typename Archive>
407 template <
typename T,
typename Archive>
415 template <
typename T,
typename Archive>
423 template <
typename T,
typename Archive>
431 template <
typename T,
typename Archive>
439 template <
typename T,
typename Archive>
442 template <
typename Archive,
typename T,
typename Enabler =
void>
452 template <
typename Archive,
typename T>
457 template <
typename Archive,
typename T>
460 template <
typename Archive,
typename T>
466 class BaseInputArchive;
467 class BaseOutputArchive;
468 class BinaryFstreamOutputArchive;
469 class BinaryFstreamInputArchive;
470 class BufferOutputArchive;
471 class BufferInputArchive;
472 class VectorOutputArchive;
473 class VectorInputArchive;
474 class TextFstreamOutputArchive;
475 class TextFstreamInputArchive;
476 class MPIRawOutputArchive;
477 class MPIRawInputArchive;
478 class MPIOutputArchive;
479 class MPIInputArchive;
480 class ContainerRecordInputArchive;
481 class ContainerRecordOutputArchive;
482 template <
class localarchiveT>
483 class ParallelOutputArchive;
484 template <
class localarchiveT>
485 class ParallelInputArchive;
486 template <
typename T>
497 template <
typename T,
typename Enabler =
void>
500 template <
typename T>
503 template <
typename T>
504 inline constexpr
bool is_archive_v = meta::is_detected_v<is_archive_defined_t,T>;
514 template <
typename T,
typename Enabler =
void>
517 template <
typename T>
520 template <
typename T>
530 template <
typename T,
typename Enabler =
void>
533 template <
typename T>
536 template <
typename T>
539 template <
typename T>
541 template <
typename T>
543 template <
typename T>
545 template <
typename T>
547 template <
typename T>
549 template <
typename T>
553 template <
typename T>
554 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 {};
555 template <
typename T>
556 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 {};
557 template <
typename T>
559 template <
typename T>
561 template <
typename T>
563 template <
typename T>
565 template <
typename T>
567 template <
typename T>
569 template <
typename T,
class localarchiveT>
571 template <
typename T,
class localarchiveT>
573 template <
typename Archive,
typename T>
574 struct is_default_serializable_helper<Archive, archive::archive_array<T>, std::enable_if_t<is_default_serializable_helper<Archive,T>::value>> : std::true_type {};
577 struct is_archive<archive::BinaryFstreamOutputArchive> : std::true_type {};
579 struct is_archive<archive::BinaryFstreamInputArchive> : std::true_type {};
581 struct is_archive<archive::BufferOutputArchive> : std::true_type {};
583 struct is_archive<archive::BufferInputArchive> : std::true_type {};
585 struct is_archive<archive::VectorOutputArchive> : std::true_type {};
587 struct is_archive<archive::VectorInputArchive> : std::true_type {};
589 struct is_archive<archive::TextFstreamOutputArchive> : std::true_type {};
591 struct is_archive<archive::TextFstreamInputArchive> : std::true_type {};
593 struct is_archive<archive::MPIRawOutputArchive> : std::true_type {};
595 struct is_archive<archive::MPIRawInputArchive> : std::true_type {};
597 struct is_archive<archive::MPIOutputArchive> : std::true_type {};
599 struct is_archive<archive::MPIInputArchive> : std::true_type {};
601 struct is_archive<archive::ContainerRecordOutputArchive> : std::true_type {};
603 struct is_archive<archive::ContainerRecordInputArchive> : std::true_type {};
604 template <
class localarchiveT>
605 struct is_archive<archive::ParallelOutputArchive<localarchiveT> > : std::true_type {};
606 template <
class localarchiveT>
607 struct is_archive<archive::ParallelInputArchive<localarchiveT> > : std::true_type {};
623 template <
class localarchiveT>
640 template <
class localarchiveT>
641 struct is_input_archive<archive::ParallelInputArchive<localarchiveT> > : std::true_type {};
646 template <
typename Archive,
typename T>
648 has_nonmember_serialize_v<T, Archive> ||
649 ((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>) ||
650 ((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>));
652 template <
typename Archive,
typename T>
660 template <
typename Archive,
typename T>
661 inline constexpr
bool is_serializable_v = is_archive_v<Archive> && (is_default_serializable_v<Archive, T> ||
662 is_user_serializable_v<Archive,T>);
664 template <
typename Archive,
typename T>
667 template <
typename Archive,
typename T>
673 template <
typename Archive,
typename Enabler =
void>
683 template <
typename Archive>
696 #define REMCONST(TYPE) typename std::remove_const< TYPE >::type
697 #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
std::enable_if_t< ! is_default_serializable< Archive, T >::value &&is_archive< Archive >::value, void > serialize(const Archive &ar, const T *t, unsigned int n)
Serialize (or deserialize) an array of non-fundamental stuff.
Definition: archive.h:497
std::enable_if_t< is_output_archive< Archive >::value &&is_default_serializable< Archive, T >::value &&is_function_pointer_v< T >, void > default_serialize(const Archive &ar, const T *t, unsigned int n)
Serialize an array of fundamental stuff.
Definition: archive.h:402
decltype(madness::operators::operator<<(std::declval< From >(), std::declval< To >())) right_shift_in_ns_madness_operators
Definition: type_traits.h:254
decltype(std::declval< From >() > > std::declval< To >()) right_shift
Definition: type_traits.h:253
decltype(madness::operators::operator<<(std::declval< To >(), std::declval< From >())) left_shift_in_ns_madness_operators
Definition: type_traits.h:236
decltype(std::declval< To >()<< std::declval< From >()) left_shift
Definition: type_traits.h:235
std::ostream & operator>>(std::ostream &, __x &)
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
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
constexpr bool has_nonmember_load_and_store_v
Definition: type_traits.h:381
typename future_to_ref< T >::type future_to_ref_t
Definition: type_traits.h:192
constexpr bool is_serializable_v
Definition: type_traits.h:661
typename remove_fcvr< T >::type remove_fcvr_t
Definition: type_traits.h:202
constexpr bool is_always_serializable
Definition: type_traits.h:272
decltype(madness::archive::ArchiveImpl< Archive, T >::wrap_load(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_wrap_load_t
Definition: type_traits.h:308
decltype(std::declval< T & >().serialize(std::declval< Archive & >())) has_member_serialize_t
Definition: type_traits.h:282
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:267
decltype(serialize(std::declval< Archive & >(), std::declval< T & >(), 1u)) has_freestanding_serialize_with_size_t
Definition: type_traits.h:323
constexpr bool has_nonmember_wrap_load_v
Definition: type_traits.h:389
decltype(serialize(std::declval< Archive & >(), std::declval< T & >())) has_freestanding_serialize_t
Definition: type_traits.h:318
constexpr bool is_default_serializable_v< Archive, const T >
Definition: type_traits.h:461
constexpr bool is_user_serializable_v< Archive, const T >
Definition: type_traits.h:653
constexpr bool has_member_serialize_v
Definition: type_traits.h:346
constexpr bool has_freestanding_serialize_with_size_v
Definition: type_traits.h:416
constexpr bool has_nonmember_wrap_load_and_store_v
Definition: type_traits.h:400
decltype(default_serialize(std::declval< Archive & >(), std::declval< const T & >(), 1u)) has_freestanding_default_serialize_with_size_t
Definition: type_traits.h:338
constexpr bool has_freestanding_serialize_with_version_v
Definition: type_traits.h:424
constexpr bool has_freestanding_serialize_v
Definition: type_traits.h:408
decltype(madness::archive::ArchiveSerializeImpl< Archive, T >::serialize(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_serialize_t
Definition: type_traits.h:293
constexpr bool is_iostreammable_v
providing automatic support for serializing to/from std streams requires bidirectional streammability
Definition: type_traits.h:270
constexpr bool is_user_serializable_v
Definition: type_traits.h:647
typename is_input_archive< std::remove_reference_t< std::remove_cv_t< T > >>::type is_input_archive_defined_t
Definition: type_traits.h:518
decltype(madness::archive::ArchiveLoadImpl< Archive, T >::load(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_load_t
Definition: type_traits.h:298
constexpr bool is_ostreammable_v
Shortcut for is_ostreammable<T>::value.
Definition: type_traits.h:248
typename is_archive< std::remove_reference_t< std::remove_cv_t< T > >>::type is_archive_defined_t
Definition: type_traits.h:501
typename is_output_archive< std::remove_reference_t< std::remove_cv_t< T > >>::type is_output_archive_defined_t
Definition: type_traits.h:534
constexpr bool is_default_serializable_v
Definition: type_traits.h:458
decltype(default_serialize(std::declval< Archive & >(), std::declval< T & >())) has_freestanding_default_serialize_t
Definition: type_traits.h:333
constexpr bool is_output_archive_v
Definition: type_traits.h:537
constexpr bool has_nonmember_wrap_store_v
Definition: type_traits.h:397
constexpr bool has_freestanding_default_serialize_v
Definition: type_traits.h:432
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:328
constexpr bool is_input_archive_v
Definition: type_traits.h:521
constexpr bool has_member_serialize_with_version_v
Definition: type_traits.h:354
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:303
constexpr bool has_nonmember_serialize_v
Definition: type_traits.h:362
decltype(std::declval< T & >().serialize(std::declval< Archive & >(), 0u)) has_member_serialize_with_version_t
Definition: type_traits.h:288
constexpr bool is_serializable_v< Archive, const T >
Definition: type_traits.h:665
constexpr bool has_nonmember_store_v
Definition: type_traits.h:378
constexpr bool is_archive_v
Definition: type_traits.h:504
constexpr const bool is_text_archive_v
is_text_archive_v is a shorthand for is_text_archive<A>::value
Definition: type_traits.h:684
decltype(madness::archive::ArchiveImpl< Archive, T >::wrap_store(std::declval< Archive & >(), std::declval< T & >())) has_nonmember_wrap_store_t
Definition: type_traits.h:313
constexpr bool has_nonmember_load_v
Definition: type_traits.h:370
typename remove_future< T >::type remove_future_t
C++11 version of REMFUTURE.
Definition: type_traits.h:166
constexpr bool has_freestanding_default_serialize_with_size_v
Definition: type_traits.h:440
constexpr bool is_trivially_serializable_v
Definition: type_traits.h:230
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
Default implementations of wrap_store and wrap_load.
Definition: archive.h:726
Default load of an object via serialize(ar, t).
Definition: archive.h:666
Default symmetric serialization of a non-fundamental type that has serialize method.
Definition: archive.h:554
Default store of an object via serialize(ar, t).
Definition: archive.h:611
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:498
Definition: type_traits.h:443
is std::true_type if T can be serialized to Archive without specialized serialize() method
Definition: type_traits.h:453
static constexpr bool value
Definition: type_traits.h:454
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:257
Definition: type_traits.h:264
Definition: type_traits.h:239
Definition: type_traits.h:245
Checks if T is an output archive type.
Definition: type_traits.h:531
Definition: type_traits.h:668
This trait types tests if Archive is a text archive.
Definition: type_traits.h:674
Definition: type_traits.h:220
static const bool value
Definition: type_traits.h:221
Definition: type_traits.h:197
remove_future< typename std::remove_cv< typename std::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
double u(const double x, const double expnt)
Definition: testperiodic.cc:56