File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,12 @@ struct constant {
2828 T value_;
2929};
3030
31+ // Deduction guide for `constant<T>`
32+ #if defined(__cpp_deduction_guides)
33+ template <typename T>
34+ constant (T&&) -> constant<decay_t<T>>;
35+ #endif
36+
3137template <typename T = double >
3238KERNEL_FLOAT_INLINE constexpr constant<T> make_constant (T value) {
3339 return value;
Original file line number Diff line number Diff line change 11#ifndef KERNEL_FLOAT_PRELUDE_H
22#define KERNEL_FLOAT_PRELUDE_H
33
4+ #include " bf16.h"
45#include " constant.h"
6+ #include " fp16.h"
57#include " vector.h"
68
79namespace kernel_float {
@@ -94,6 +96,18 @@ static constexpr kconstant<long long int> operator""_c(unsigned long long int v)
9496 return static_cast <long long int >(v);
9597}
9698
99+ // Deduction guides for aliases are only supported from C++20
100+ #if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907L
101+ template <typename T>
102+ kscalar (T&&) -> kscalar<decay_t<T>>;
103+
104+ template <typename ... Args>
105+ kvec (Args&&...) -> kvec<promote_t<Args...>, sizeof...(Args)>;
106+
107+ template <typename T>
108+ kconstant (T&&) -> kconstant<decay_t<T>>;
109+ #endif
110+
97111} // namespace prelude
98112} // namespace kernel_float
99113
You can’t perform that action at this time.
0 commit comments