23 #ifndef LARCOREALG_COREUTILS_METAUTILS_H 24 #define LARCOREALG_COREUTILS_METAUTILS_H 31 #include <string_view> 32 #include <type_traits> 165 template <
typename A,
typename B>
188 template <
typename T, std::size_t StartFrom,
typename... Types>
191 template <
typename T, std::size_t StartFrom,
typename... Types>
211 template <
typename T,
typename... Types>
216 template <
typename T,
typename... Types>
229 template <
typename T,
typename... Types>
233 template <
typename T,
typename... Types>
238 template <
typename T,
typename U>
298 template <
typename T>
301 template <
typename T>
304 staticDumpClassName<T>();
344 template <
template <
typename...>
typename Template,
typename T>
349 template <
template <
typename...>
typename Template,
typename T>
358 template <
typename T>
366 template <
typename T>
375 template <
typename T>
384 template <
typename T>
393 template <
typename T>
402 template <
typename T>
414 template <
typename T>
418 template <
typename T>
432 template <
typename T>
436 template <
typename T>
447 template <
typename T>
452 template <
typename T>
463 template <
typename T>
468 template <
typename T>
505 template <
typename Base,
typename Key>
514 template <
typename Base,
typename Key>
530 template <
typename T>
538 template <
typename T>
552 template <
typename Ref>
573 template <
typename Ref>
574 decltype(
auto) operator()(Ref&& ref)
const 576 return addressof(std::forward<Ref>(ref));
579 template <
typename Ref>
580 static decltype(
auto) addressof(Ref&& ref)
601 template <
typename T>
609 template <
typename T>
623 template <
typename T>
645 template <std::size_t Index, std::size_t Skip,
typename T,
typename... Types>
648 template <std::size_t Index, std::size_t Skip,
typename T,
typename Type,
typename... Others>
650 : std::integral_constant<
652 (Skip == 0) && std::is_same_v<T, Type> ?
654 find_type_impl<Index + 1U, ((Skip > 0U) ? Skip - 1U : 0U), T, Others...>
::value> {};
656 template <std::
size_t Index, std::
size_t Skip,
typename T>
657 struct find_type_impl<Index, Skip, T> : std::integral_constant<std::size_t, Index> {};
660 template <
typename T,
typename =
void>
676 template <
typename T,
typename =
void>
679 template <
typename T>
682 std::enable_if_t<is_character_type_impl<typename T::value_type>::value>> : std::true_type {};
684 template <
typename T>
687 std::enable_if_t<std::is_pointer_v<std::decay_t<T>> &&
688 is_character_type_impl<std::remove_pointer_t<std::decay_t<T>>>::value>>
691 template <
typename T>
694 std::enable_if_t<std::is_array_v<std::decay_t<T>> &&
695 is_character_type_impl<std::remove_extent_t<std::decay_t<T>>>::value>>
699 template <
typename T>
702 template <
typename... Args>
706 template <
typename T>
709 template <
typename... Args>
714 template <
typename T>
717 "ClassNameStaticDumper<T>: look for T in the error message context");
724 template <
typename Base,
typename ,
typename =
void>
726 using type = std::remove_const_t<Base>;
729 template <
typename Base,
typename Key>
731 using type = std::add_const_t<Base>;
736 template <
typename Base,
typename Key,
typename =
void>
739 template <
typename Base,
typename Key>
742 std::enable_if_t<std::is_lvalue_reference_v<Base>>> {
743 using type = std::add_lvalue_reference_t<
747 template <
typename Base,
typename Key>
750 std::enable_if_t<std::is_rvalue_reference_v<Base>>> {
751 using type = std::add_rvalue_reference_t<
756 template <
typename Base,
typename Key>
761 template <
typename Base,
typename Key>
766 template <
template <
typename...>
typename Template,
typename T>
769 template <
template <
typename...>
typename Template,
typename... Args>
775 template <
typename T>
779 template <
typename T,
typename =
void>
785 template <
typename T>
788 std::enable_if_t<util::is_reference_wrapper_v<std::remove_cv_t<T>>>>
793 template <
typename T>
796 template <
typename T>
799 template <
typename T>
803 template <
typename T>
809 template <
typename T,
typename =
void>
811 static auto addressof(T& obj) {
return std::addressof(obj); }
814 template <
typename T>
816 static auto addressof(T& obj) {
return std::addressof(obj.get()); }
826 template <
typename T>
828 using type = std::remove_reference_t<T>;
831 template <
typename T>
833 using type = std::reference_wrapper<T>;
836 template <
typename T,
typename =
void>
841 template <
typename T>
844 std::enable_if_t<util::is_reference_wrapper_v<T>>> {
845 using type = std::remove_reference_t<T>;
848 template <
typename T>
857 template <
template <
typename...>
typename Template,
typename T>
861 template <
typename T, std::size_t StartFrom,
typename... Types>
865 template <
typename T,
typename... Types>
869 template <typename T>
870 struct is_character_type : details::is_character_type_impl<T> {};
873 template <typename T>
874 struct is_string_type : details::is_string_type_impl<T> {};
877 template <typename T>
878 struct is_basic_string_type : details::is_basic_string_type_impl<std::decay_t<T>> {};
881 template <typename T>
882 struct is_basic_string_view_type : details::is_basic_string_view_type_impl<std::decay_t<T>> {};
885 template <typename T>
886 void staticDumpClassName()
888 (void)details::ClassNameStaticDumper<T>();
893 struct is_STLarray : public std::false_type {};
895 template <typename T, std::size_t N>
896 struct is_STLarray<std::array<T, N>> : public std::true_type {};
899 template <typename Base, typename Key>
900 struct with_const_as : public details::with_const_as_dispatcher<Base, Key> {};
903 template <typename T>
904 struct strip_referenceness_type : public details::strip_referenceness_type_impl<T> {};
907 template <typename T>
908 struct lvalue_reference_into_wrapper_type
909 : public details::lvalue_reference_into_wrapper_type_impl<T> {};
912 template <typename Ref>
913 auto referenced_address(Ref&& ref)
915 return details::referenced_address_impl<Ref>::addressof(ref);
Implementation detail of staticDumpClassName().
Namespace for general, non-LArSoft-specific utilities.
Functor applying the proper referenced_address() function.
std::add_rvalue_reference_t< typename with_const_as_impl< std::remove_reference_t< Base >, Key >::type > type
Identifies whether the specified type is a STL array.
typename lvalue_reference_into_wrapper_type_impl_final< T >::type type
std::remove_const_t< Base > type
std::integral_constant< bool, Value > bool_constant
static auto addressof(T &obj)
Trait with type Base, plus the constantness as in Key.
A std::false_type with a template argument.
std::add_lvalue_reference_t< typename with_const_as_impl< std::remove_reference_t< Base >, Key >::type > type
Trait: whether type T is a character string type.
Trait: whether type T is a character type.
std::remove_reference_t< T > type
Trait returning the very same type as in the template argument.
A std::true_type with a template argument.
Trait with type T stripped of all known reference types.
Trait: index of the first occurrence of T among the specified Types, starting from the one with index...
Trait describing whether T is a template instance of Template.
Trait: whether type T is a STL string type.
Trait: whether T is among the specified Types.
static auto addressof(T &obj)
Trait with type T into std::reference_wrapper if reference.
Trait: whether type T is a std::string_view type.