Skip to content

Commit 7f5a6b0

Browse files
feat: Add with function for creating primitive types with policies
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
1 parent 4943abc commit 7f5a6b0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/primitive/impl.cppm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ constexpr auto with(T value) noexcept(
242242
return primitive<std::remove_cv_t<T>, Policies...>{value};
243243
}
244244

245+
template <policy::policy_type... Policies, underlying_type T>
246+
constexpr auto with(std::tuple<Policies...>, T value) noexcept(
247+
noexcept(primitive<std::remove_cv_t<T>, Policies...>{value}))
248+
-> primitive<std::remove_cv_t<T>, Policies...> {
249+
return primitive<std::remove_cv_t<T>, Policies...>{value};
250+
}
251+
245252
namespace types {
246253
template <policy::policy_type... Policies>
247254
using Bool = primitive<bool, Policies...>;

0 commit comments

Comments
 (0)