6#ifndef MIMICPP_UTILITY_HPP
7#define MIMICPP_UTILITY_HPP
15#include <source_location>
22 template <
typename...>
24 :
public std::bool_constant<false>
28 template <std::
size_t priority>
43 const std::source_location& lhs,
44 const std::source_location& rhs)
noexcept
46 return std::string_view{lhs.file_name()} == std::string_view{rhs.file_name()}
47 && std::string_view{lhs.function_name()} == std::string_view{rhs.function_name()}
48 && lhs.line() == rhs.line()
49 && lhs.column() == rhs.column();
52 template <
typename From,
typename To>
55 static_cast<To
>(std::declval<From>());
58 template <
typename From,
typename To>
62 {
static_cast<To
>(std::declval<From>()) }
noexcept;
65 template <
typename T,
typename... Others>
69 requires std::is_enum_v<T>
71 constexpr std::underlying_type_t<T>
to_underlying(
const T value)
noexcept
73 return static_cast<std::underlying_type_t<T>
>(value);
76 template <
typename T,
template <
typename>
typename Trait>
81#ifdef __cpp_lib_unreachable
82 using std::unreachable;
98 #if defined(_MSC_VER) && !defined(__clang__)
101 __builtin_unreachable();
121namespace mimicpp::detail
123 template <
typename Parsed,
typename... Rest>
126 template <
typename... Uniques,
typename First,
typename... Others>
128 type_list<Uniques...>,
132 using current_t = std::conditional_t<
133 same_as_any<First, Uniques...>,
134 type_list<Uniques...>,
135 type_list<Uniques..., First>>;
137 using type_t =
typename unique<
142 template <
typename... Uniques>
143 struct unique<type_list<Uniques...>>
145 using type_t = type_list<Uniques...>;
148 template <
typename... Types>
149 using unique_list_t =
typename unique<type_list<>, Types...>::type_t;
151 template <std::default_initializable FillElement, std::size_t n,
typename... Elements>
152 requires(
sizeof...(Elements) <= n)
154 constexpr auto expand_tuple(std::tuple<Elements...>&& tuple)
158 return std::tuple_cat(
161 [](
auto&&... elements) {
return std::make_tuple(std::move(elements)...); },
162 std::array<FillElement, n -
sizeof...(Elements)>{}));
Definition Utility.hpp:53
Definition Utility.hpp:59
Definition Utility.hpp:66
Definition Utility.hpp:77
Definition BoostTest.hpp:20
void unreachable()
Invokes undefined behavior.
Definition Utility.hpp:91
constexpr bool is_same_source_location(const std::source_location &lhs, const std::source_location &rhs) noexcept
Definition Utility.hpp:42
ValueCategory
Definition Fwd.hpp:32
constexpr bool is_matching(const Constness lhs, const Constness rhs) noexcept
Definition Utility.hpp:109
Constness
Definition Fwd.hpp:25
constexpr std::underlying_type_t< T > to_underlying(const T value) noexcept
Definition Utility.hpp:71
Definition Utility.hpp:25
Definition Utility.hpp:33