@@ -1294,9 +1294,10 @@ namespace specialization_helper {
12941294// / The idea with the specialization helper is to create a copy of a given
12951295// / algorithm with some parameters set to fixed values (specialized) so the
12961296// / compiler can perform additional optimization for the specific variant.
1297- // / This is achieved by marking the generic functions `ALWAYS_INLINE` inline
1298- // / and defining a macro invoking match/specialize so you can choose between
1299- // / fixed and variable values for each parameter.
1297+ // / This is achieved by marking the generic functions `constexpr` so their
1298+ // / results can be evaluated at compile time and defining a macro invoking
1299+ // / match/specialize so you can choose between fixed and variable values for
1300+ // / each parameter.
13001301
13011302template <typename T>
13021303struct FixedParameter {
@@ -1305,26 +1306,26 @@ struct FixedParameter {
13051306struct VariableParameter {};
13061307
13071308template <typename T>
1308- ALWAYS_INLINE constexpr FixedParameter<T> fixed (T value) {
1309+ constexpr FixedParameter<T> fixed (T value) {
13091310 return FixedParameter<T>{value};
13101311}
13111312constexpr VariableParameter var = VariableParameter();
13121313
13131314template <typename T>
1314- ALWAYS_INLINE bool match (VariableParameter /* unused*/ , T /* unused*/ ) {
1315+ constexpr bool match (VariableParameter /* unused*/ , T /* unused*/ ) {
13151316 return true ;
13161317}
13171318template <typename T>
1318- ALWAYS_INLINE bool match (FixedParameter<T> fixed_parameter, T value) {
1319+ constexpr bool match (FixedParameter<T> fixed_parameter, T value) {
13191320 return fixed_parameter.value == value;
13201321}
13211322
13221323template <typename T>
1323- ALWAYS_INLINE T specialize (VariableParameter /* unused*/ , T value) {
1324+ constexpr T specialize (VariableParameter /* unused*/ , T value) {
13241325 return value;
13251326}
13261327template <typename T>
1327- ALWAYS_INLINE T specialize (FixedParameter<T> fixed_parameter, T /* unused*/ ) {
1328+ constexpr T specialize (FixedParameter<T> fixed_parameter, T /* unused*/ ) {
13281329 return fixed_parameter.value ;
13291330}
13301331} // namespace specialization_helper
0 commit comments