58 #ifndef LIB_META_TRAIT_H 59 #define LIB_META_TRAIT_H 65 #include <type_traits> 75 template<
class X,
class D>
class unique_ptr;
80 template<
class X,
class B>
class P;
99 using std::remove_cv_t;
100 using std::remove_pointer;
101 using std::remove_pointer_t;
102 using std::remove_reference;
103 using std::remove_reference_t;
104 using std::is_pointer;
105 using std::is_base_of;
106 using std::is_convertible;
107 using std::is_constructible;
108 using std::is_floating_point;
109 using std::is_arithmetic;
110 using std::is_unsigned;
111 using std::is_signed;
136 return const_cast<X&
> (x);
151 using Type = remove_cv_t<X>;
154 extract (
const X* ptr)
157 return const_cast<Type&
> (*ptr);
187 template<
typename X,
class D>
194 extract (std::unique_ptr<X,D>
const& ptr)
215 template<
typename X,
class B>
238 typename Unwrap<X>::Type&
251 using TypeUnconst = remove_cv_t<X>;
252 using TypeReferred = remove_reference_t<TypeUnconst>;
253 using TypePointee = remove_pointer_t<TypeReferred>;
254 using TypePlain = remove_cv_t<TypePointee>;
256 using Type =
typename Unwrap<TypePlain>::Type;
269 template<
typename TY>
274 typedef TY& Reference;
277 template<
typename TY>
281 typedef TY** Pointer;
282 typedef TY*& Reference;
285 template<
typename TY>
290 typedef TY& Reference;
293 template<
typename TY>
298 typedef TY& Reference;
310 template<
typename T,
typename U>
312 : is_same <typename Strip<T>::TypeReferred
313 ,typename Strip<U>::TypeReferred>
317 template<
typename S,
typename I>
319 : __or_< __and_< is_class<I>
328 template<
typename S,
typename I>
331 ,typename Strip<I>::TypeReferred>
335 template<
typename S,
typename G>
337 : std::is_convertible<typename RefTraits<S>::Reference
338 ,typename RefTraits<G>::Reference
345 : __or_< is_basically<X, std::string>
346 , is_basically<X, std::string_view>
347 , is_convertible<X, const char*>
369 : __or_< is_arithmetic<X>
376 : __and_<can_lexical2string<X>
377 ,__not_<can_convertToString<X>>
384 : is_same<X, std::basic_filebuf<char, std::char_traits<char> > >
390 : __and_<is_class<typename Strip<X>::TypePlain>
391 ,__not_<is_pointer<X>>
392 ,__not_<can_lexical2string<X>>
393 ,__not_<is_StreamSource<X>>
409 template <
typename T,
typename D>
419 template<
typename NUM>
421 : __and_<is_arithmetic<NUM>
422 ,__not_<is_floating_point<NUM>>
442 template<
typename SRC,
typename TAR>
444 : __or_<__and_<is_unsigned<SRC>, is_signed<TAR>>
445 ,__and_<is_signed<SRC>, is_unsigned<TAR>>
446 ,__and_<is_nonFloat<SRC>, is_floating_point<TAR>>
447 ,__and_<is_floating_point<SRC>, is_nonFloat<TAR>>
448 ,__not_<is_constructible<TAR, SRC>>
452 template<
typename TAR>
454 : __or_<is_arithmetic<TAR>
455 ,is_floating_point<TAR>
459 #define TRAIT_IS_NARROWING(_SRC_, _TAR_) \ 461 struct is_narrowingInit<_SRC_, _TAR_> \ 465 TRAIT_IS_NARROWING (int64_t, int32_t)
466 TRAIT_IS_NARROWING (int64_t, int16_t)
467 TRAIT_IS_NARROWING (int64_t, int8_t)
468 TRAIT_IS_NARROWING (int64_t,
char)
469 TRAIT_IS_NARROWING (int32_t, int16_t)
470 TRAIT_IS_NARROWING (int32_t, int8_t)
471 TRAIT_IS_NARROWING (int32_t,
char)
472 TRAIT_IS_NARROWING (int16_t, int8_t)
473 TRAIT_IS_NARROWING (int16_t,
short)
474 TRAIT_IS_NARROWING (int16_t,
char)
476 TRAIT_IS_NARROWING (uint64_t, uint32_t)
477 TRAIT_IS_NARROWING (uint64_t, uint16_t)
478 TRAIT_IS_NARROWING (uint64_t, uint8_t)
479 TRAIT_IS_NARROWING (uint32_t, uint16_t)
480 TRAIT_IS_NARROWING (uint32_t, uint8_t)
481 TRAIT_IS_NARROWING (uint16_t, uint8_t)
482 TRAIT_IS_NARROWING (uint16_t, ushort)
484 TRAIT_IS_NARROWING (
double,
float)
489 #undef TRAIT_IS_NARROWING 507 using Type =
typename Strip<T>::Type;
514 enum{ value = std::is_constructible<bool, Type>::value
515 and HasNested_value_type<Type>::value
516 and HasOperator_deref<Type>::value
517 and HasOperator_inc<Type>::value
531 using Type =
typename Strip<T>::Type;
538 enum{ value = HasArglessFun_checkPoint<Type>::value
539 and HasArglessFun_iterNext<Type>::value
540 and HasArglessFun_yield<Type>::value
552 using Type =
typename Strip<T>::Type;
560 enum { value = HasNested_iterator<Type>::value
561 and HasFunSig_begin<Type>::value
562 and HasFunSig_end<Type>::value
572 enum { value = HasNested_iterator<Type>::value
573 and HasFunSig_begin<Type>::value
574 and HasFunSig_end<Type>::value
584 enum { value = HasNested_const_iterator<Type>::value
585 and HasFunSig_begin<Type>::value
586 and HasFunSig_end<Type>::value
596 enum { value = HasNested_const_iterator<Type>::value
597 and HasFunSig_begin<Type>::value
598 and HasFunSig_end<Type>::value
604 enum { value = is_iterable::value
605 or is_const_iterable::value
606 or is_noexcept_iterable::value
607 or is_const_noexcept_iterable::value
616 using Type =
typename Strip<T>::Type;
624 enum { value = HasNested_reverse_iterator<Type>::value
625 and HasFunSig_rbegin<Type>::value
626 and HasFunSig_rend<Type>::value
636 enum { value = HasNested_reverse_iterator<Type>::value
637 and HasFunSig_rbegin<Type>::value
638 and HasFunSig_rend<Type>::value
648 enum { value = HasNested_const_reverse_iterator<Type>::value
649 and HasFunSig_rbegin<Type>::value
650 and HasFunSig_rend<Type>::value
660 enum { value = HasNested_const_reverse_iterator<Type>::value
661 and HasFunSig_rbegin<Type>::value
662 and HasFunSig_rend<Type>::value
668 enum { value = is_backIterable::value
669 or is_const_backIterable::value
670 or is_noexcept_backIterable::value
671 or is_const_noexcept_backIterable::value
A refcounting Handle to an MObject of type MO, used to constrain or explicitly specify the location w...
#define META_DETECT_OPERATOR_INC()
Detector for a prefix increment operator.
Representation of the result of some operation, EITHER a value or a failure.
#define META_DETECT_FUNCTION(_RET_TYPE_, _FUN_NAME_, _ARGS_)
Detector for a specific member function.
Steam-Layer implementation namespace root.
Implementation namespace for support and library code.
#define META_DETECT_FUNCTION_ARGLESS(_FUN_)
Detector for an argument-less member function with the given name.
#define META_DETECT_OPERATOR_DEREF()
Detector for a dereferentiation operator.
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor...
Duration is the internal Lumiera time metric.
Unwrap< X >::Type & unwrap(X const &wrapped)
convenience shortcut: unwrapping free function.
#define META_DETECT_NESTED(_TYPE_)
Detector for a nested type.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
basic constant internal time value.
Metaprogramming helpers to check for specific properties of a type in question.