Skip to content

Commit

Permalink
std::initializer_list を取るオーバーロードの戻り値を auto に変更
Browse files Browse the repository at this point in the history
  • Loading branch information
Raclamusi committed Nov 26, 2024
1 parent f7914be commit 340466b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Siv3D/include/Siv3D/DiscreteDistribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ namespace s3d

template <class Type, class URBG>
[[nodiscard]]
inline decltype(auto) DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight, URBG&& urbg);
inline auto DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight, URBG&& urbg);

template <class Type>
[[nodiscard]]
inline decltype(auto) DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight);
inline auto DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight);
}

# include "detail/DiscreteDistribution.ipp"
4 changes: 2 additions & 2 deletions Siv3D/include/Siv3D/detail/DiscreteDistribution.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ namespace s3d
}

template <class Type, class URBG>
inline decltype(auto) DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight, URBG&& urbg)
inline auto DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight, URBG&& urbg)
{
assert(ilist.size() != 0);
return *(ilist.begin() + weight(std::forward<URBG>(urbg)));
}

template <class Type>
inline decltype(auto) DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight)
inline auto DiscreteSample(std::initializer_list<Type> ilist, DiscreteDistribution& weight)
{
return DiscreteSample(ilist, weight, GetDefaultRNG());
}
Expand Down

0 comments on commit 340466b

Please sign in to comment.