Skip to content

Commit

Permalink
tree.h: Fix SetModelPresetVariant variant_index template parameter (#600
Browse files Browse the repository at this point in the history
)

* tree.h: Fix SetModelPresetVariant variant_index template parameter

Fixes compiling with -Werror=sign-conversion
Fixes #599

* Update include/treelite/tree.h

---------

Co-authored-by: Philip Hyunsu Cho <[email protected]>
  • Loading branch information
davidgraeff and hcho3 authored Jan 11, 2025
1 parent d0eef62 commit b02b277
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/treelite/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ class ModelPreset {

using ModelPresetVariant = std::variant<ModelPreset<float, float>, ModelPreset<double, double>>;

template <int variant_index>
ModelPresetVariant SetModelPresetVariant(int target_variant_index) {
template <std::size_t variant_index>
ModelPresetVariant SetModelPresetVariant(std::size_t target_variant_index) {
ModelPresetVariant result;
if constexpr (variant_index != std::variant_size_v<ModelPresetVariant>) {
if (variant_index == target_variant_index) {
Expand Down

0 comments on commit b02b277

Please sign in to comment.