6#ifndef MIMICPP_UTILITY_HPP
7#define MIMICPP_UTILITY_HPP
14#include <source_location>
20 template <
typename...>
22 :
public std::bool_constant<false>
26 template <std::
size_t priority>
41 const std::source_location& lhs,
42 const std::source_location& rhs)
noexcept
44 return std::string_view{lhs.file_name()} == std::string_view{rhs.file_name()}
45 && std::string_view{lhs.function_name()} == std::string_view{rhs.function_name()}
46 && lhs.line() == rhs.line()
47 && lhs.column() == rhs.column();
50 template <
typename From,
typename To>
53 static_cast<To
>(std::declval<From>());
56 template <
typename From,
typename To>
60 {
static_cast<To
>(std::declval<From>()) }
noexcept;
63 template <
typename T,
typename... Others>
67 requires std::is_enum_v<T>
69 constexpr std::underlying_type_t<T>
to_underlying(
const T value)
noexcept
71 return static_cast<std::underlying_type_t<T>
>(value);
74 template <
typename T,
template <
typename>
typename Trait>
79#ifdef __cpp_lib_unreachable
80 using std::unreachable;
96 #if defined(_MSC_VER) && !defined(__clang__)
99 __builtin_unreachable();
119namespace mimicpp::detail
121 template <
typename Parsed,
typename... Rest>
124 template <
typename... Uniques,
typename First,
typename... Others>
126 type_list<Uniques...>,
130 using current_t = std::conditional_t<
131 same_as_any<First, Uniques...>,
132 type_list<Uniques...>,
133 type_list<Uniques..., First>>;
135 using type_t =
typename unique<
140 template <
typename... Uniques>
141 struct unique<type_list<Uniques...>>
143 using type_t = type_list<Uniques...>;
146 template <
typename... Types>
147 using unique_list_t =
typename unique<type_list<>, Types...>::type_t;
Definition Utility.hpp:51
Definition Utility.hpp:57
Definition Utility.hpp:64
Definition Utility.hpp:75
Definition BoostTest.hpp:20
void unreachable()
Invokes undefined behavior.
Definition Utility.hpp:89
constexpr bool is_same_source_location(const std::source_location &lhs, const std::source_location &rhs) noexcept
Definition Utility.hpp:40
ValueCategory
Definition Fwd.hpp:30
constexpr bool is_matching(const Constness lhs, const Constness rhs) noexcept
Definition Utility.hpp:107
Constness
Definition Fwd.hpp:23
constexpr std::underlying_type_t< T > to_underlying(const T value) noexcept
Definition Utility.hpp:69
Definition Utility.hpp:23
Definition Utility.hpp:31