15#ifndef BOTAN_STRONG_TYPE_HELPERS_H_
16#define BOTAN_STRONG_TYPE_HELPERS_H_
18#include <botan/concepts.h>
25template <
typename T,
typename Tag,
typename... Capabilities>
31template <
typename... Ts>
35template <
typename... Ts>
38template <
typename... Ts>
57template <concepts::contiguous_strong_type T>
86template <concepts::strong_type T>
89 using type =
typename T::wrapped_type;
122 return std::forward<T>(t);
125 return std::forward<T>(t).get();
141template <
typename T,
typename ParamT>
142 requires std::constructible_from<T, ParamT> ||
143 (concepts::strong_type<T> && std::constructible_from<typename T::wrapped_type, ParamT>)
145 if constexpr(std::same_as<std::remove_cvref_t<ParamT>, T>) {
147 return std::forward<ParamT>(t);
148 }
else if constexpr(std::constructible_from<T, ParamT>) {
150 return T{std::forward<ParamT>(t)};
155 return T{
typename T::wrapped_type{std::forward<ParamT>(t)}};
constexpr decltype(auto) unwrap_strong_type(T &&t)
Generically unwraps a strong type to its underlying type.
typename detail::wrapped_type_helper< std::remove_cvref_t< T > >::type strong_type_wrapped_type
Extracts the wrapped type from a strong type.
constexpr decltype(auto) wrap_strong_type(ParamT &&t)
Wraps a value into a caller-defined (strong) type.
constexpr bool is_strong_span_v
constexpr bool is_strong_type_v
typename T::wrapped_type type
The resolved type.