23 #ifndef LARCOREALG_COREUTILS_METAUTILS_H 24 #define LARCOREALG_COREUTILS_METAUTILS_H 30 #include <string_view> 33 #include <type_traits> 171 template <
bool Value>
173 [[deprecated(
"use `std::bool_constant` instead (`#include <type_traits>`")]]
174 = std::bool_constant<Value>;
176 template <
typename BoolTrait>
178 [[deprecated(
"use `std::bool_constant` instead (`#include <type_traits>`")]]
179 = std::negation<BoolTrait>;
182 template <
typename A,
typename B>
206 template <
typename T, std::size_t StartFrom,
typename... Types>
209 template <
typename T, std::size_t StartFrom,
typename... Types>
231 template <
typename T,
typename... Types>
237 template <
typename T,
typename... Types>
251 template <
typename T,
typename... Types>
255 template <
typename T,
typename... Types>
261 template <
typename T,
typename U>
263 = std::is_same_v<std::decay_t<T>, std::decay_t<U>>;
323 template <
typename T>
326 template <
typename T>
368 template <
template <
typename...>
typename Template,
typename T>
373 template <
template <
typename...>
typename Template,
typename T>
383 template <
typename T>
391 template <
typename T>
401 template <
typename T>
410 template <
typename T>
420 template <
typename T>
429 template <
typename T>
442 template <
typename T>
446 template <
typename T>
461 template <
typename T>
465 template <
typename T>
477 template <
typename T>
482 template <
typename T>
494 template <
typename T>
499 template <
typename T>
539 template <
typename Base,
typename Key>
548 template <
typename Base,
typename Key>
565 template <
typename T>
573 template <
typename T>
588 template <
typename Ref>
610 template <
typename Ref>
611 decltype(
auto) operator() (Ref&& ref)
const 612 {
return addressof(std::forward<Ref>(ref)); }
614 template <
typename Ref>
615 static decltype(
auto) addressof(Ref&& ref)
635 template <
typename T>
643 template <
typename T>
659 template <
typename T>
684 <std::size_t
Index, std::size_t Skip,
typename T,
typename... Types>
688 std::size_t
Index, std::size_t Skip,
690 typename Type,
typename... Others
693 : std::integral_constant<std::size_t,
694 (Skip == 0) && std::is_same_v<T, Type>
696 : find_type_impl<Index + 1U, ((Skip > 0U)? Skip - 1U: 0U), T, Others...>
701 template <std::
size_t Index, std::
size_t Skip,
typename T>
703 : std::integral_constant<std::size_t, Index>
708 template <
typename T,
typename =
void>
726 template <
typename T,
typename =
void>
729 template <
typename T>
732 std::enable_if_t<is_character_type_impl<typename T::value_type>::value>
737 template <
typename T>
741 std::is_pointer_v<std::decay_t<T>>
742 && is_character_type_impl<std::remove_pointer_t<std::decay_t<T>>>::value
748 template <
typename T>
752 std::is_array_v<std::decay_t<T>>
753 && is_character_type_impl<std::remove_extent_t<std::decay_t<T>>>::value
761 template <
typename T>
765 template <
typename... Args>
772 template <
typename T>
776 template <
typename... Args>
784 template <
typename T>
788 "ClassNameStaticDumper<T>: look for T in the error message context" 796 template <
typename Base,
typename ,
typename =
void>
798 {
using type = std::remove_const_t<Base>; };
800 template <
typename Base,
typename Key>
802 <
Base, Key, std::enable_if_t<std::is_const_v<Key>>>
803 {
using type = std::add_const_t<Base>; };
807 template <
typename Base,
typename Key,
typename =
void>
810 template <
typename Base,
typename Key>
812 <
Base, Key, std::enable_if_t<std::is_lvalue_reference_v<Base>>>
814 using type = std::add_lvalue_reference_t
818 template <
typename Base,
typename Key>
820 <
Base, Key, std::enable_if_t<std::is_rvalue_reference_v<Base>>>
822 using type = std::add_rvalue_reference_t
827 template <
typename Base,
typename Key>
832 template <
typename Base,
typename Key>
838 template <
template <
typename...>
typename Template,
typename T>
842 template <
template <
typename...>
typename Template,
typename... Args>
849 template <
typename T>
853 template <
typename T,
typename =
void>
858 template <
typename T>
861 std::enable_if_t<util::is_reference_wrapper_v<std::remove_cv_t<T>>>
867 template <
typename T>
871 template <
typename T>
875 template <
typename T>
880 template <
typename T>
888 template <
typename T,
typename =
void>
890 static auto addressof(T& obj) {
return std::addressof(obj); }
893 template <
typename T>
895 <T, std::enable_if_t<util::is_reference_wrapper_v<T>>>
897 static auto addressof(T& obj) {
return std::addressof(obj.get()); }
908 template <
typename T>
910 using type = std::remove_reference_t<T>;
913 template <
typename T>
915 using type = std::reference_wrapper<T>;
918 template <
typename T,
typename =
void>
924 template <
typename T>
926 <T, std::enable_if_t<util::is_reference_wrapper_v<T>>>
928 using type = std::remove_reference_t<T>;
931 template <
typename T>
944 template <
template <
typename...>
typename Template,
typename T>
950 template <
typename T, std::size_t StartFrom,
typename... Types>
955 template <
typename T,
typename... Types>
962 template <typename T>
963 struct is_character_type: details::is_character_type_impl<T> {};
967 template <typename T>
968 struct is_string_type: details::is_string_type_impl<T> {};
972 template <typename T>
973 struct is_basic_string_type
974 : details::is_basic_string_type_impl<std::decay_t<T>> {};
978 template <typename T>
979 struct is_basic_string_view_type
980 : details::is_basic_string_view_type_impl<std::decay_t<T>>
985 template <typename T>
986 void staticDumpClassName() { (void) details::ClassNameStaticDumper<T>(); }
990 struct is_STLarray: public std::false_type {};
992 template <typename T, std::size_t N>
993 struct is_STLarray<std::array<T, N>>: public std::true_type {};
996 template <typename Base, typename Key>
997 struct with_const_as: public details::with_const_as_dispatcher<Base, Key> {};
1000 template <typename T>
1001 struct strip_referenceness_type
1002 : public details::strip_referenceness_type_impl<T>
1006 template <typename T>
1007 struct lvalue_reference_into_wrapper_type
1008 : public details::lvalue_reference_into_wrapper_type_impl<T>
1012 template <typename Ref>
1013 auto referenced_address(Ref&& ref)
1014 { return details::referenced_address_impl<Ref>::addressof(ref); }
std::add_rvalue_reference_t< typename with_const_as_impl< std::remove_reference_t< Base >, Key >::type > type
Implementation detail of staticDumpClassName().
Namespace for general, non-LArSoft-specific utilities.
Functor applying the proper referenced_address() function.
Abstract interface for a template.
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.
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.
std::add_lvalue_reference_t< typename with_const_as_impl< std::remove_reference_t< Base >, Key >::type > type
Trait: whether type T is a STL string type.
Trait: whether T is among the specified Types.
Trait with type T into std::reference_wrapper if reference.
Trait: whether type T is a std::string_view type.
static auto addressof(T &obj)