@@ -106,8 +106,7 @@ template <EncoderType T = EncoderType::ROTATIONAL> class AbiEncoder : public Bas
106
106
* EncoderType::ROTATIONAL.
107
107
* @return Number of revolutions, as a floating point number.
108
108
*/
109
- template <EncoderType type = T>
110
- typename std::enable_if<type == EncoderType::ROTATIONAL, float >::type get_revolutions () {
109
+ float get_revolutions () requires(T == EncoderType::ROTATIONAL) {
111
110
auto raw = get_count ();
112
111
return (float )raw / (float )counts_per_revolution_;
113
112
}
@@ -119,8 +118,7 @@ template <EncoderType T = EncoderType::ROTATIONAL> class AbiEncoder : public Bas
119
118
* EncoderType::ROTATIONAL.
120
119
* @return Number of radians, as a floating point number.
121
120
*/
122
- template <EncoderType type = T>
123
- typename std::enable_if<type == EncoderType::ROTATIONAL, float >::type get_radians () {
121
+ float get_radians () requires(T == EncoderType::ROTATIONAL) {
124
122
return get_revolutions () * 2 .0f * M_PI;
125
123
}
126
124
@@ -131,10 +129,7 @@ template <EncoderType T = EncoderType::ROTATIONAL> class AbiEncoder : public Bas
131
129
* EncoderType::ROTATIONAL.
132
130
* @return Number of degrees, as a floating point number.
133
131
*/
134
- template <EncoderType type = T>
135
- typename std::enable_if<type == EncoderType::ROTATIONAL, float >::type get_degrees () {
136
- return get_revolutions () * 360 .0f ;
137
- }
132
+ float get_degrees () requires(T == EncoderType::ROTATIONAL) { return get_revolutions () * 360 .0f ; }
138
133
139
134
/* *
140
135
* @brief Start the pulse count hardware.
0 commit comments