Core/Algorithm: Fix Apply problems
This commit is contained in:
parent
ad82de2962
commit
9a8c807d18
|
|
@ -74,6 +74,7 @@ Nazara Engine:
|
|||
- Fixed Platform module not being classified as client-only
|
||||
- ⚠️ Renamed Bitset::Read to Bitset::Write
|
||||
- ⚠️ Added a type tag parameter to Serialize and Unserialize functions, to prevent implicit conversions with overloads
|
||||
- Fixed Apply functions with complex return types
|
||||
|
||||
Nazara Development Kit:
|
||||
- Added ImageWidget (#139)
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ namespace Nz
|
|||
{
|
||||
// http://www.cppsamples.com/common-tasks/apply-tuple-to-function.html
|
||||
template<typename F, typename Tuple, size_t... S>
|
||||
decltype(auto) ApplyImplFunc(F&& fn, Tuple&& t, std::index_sequence<S...>)
|
||||
auto ApplyImplFunc(F&& fn, Tuple&& t, std::index_sequence<S...>)
|
||||
{
|
||||
return std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...);
|
||||
}
|
||||
|
||||
template<typename O, typename F, typename Tuple, size_t... S>
|
||||
decltype(auto) ApplyImplMethod(O& object, F&& fn, Tuple&& t, std::index_sequence<S...>)
|
||||
auto ApplyImplMethod(O& object, F&& fn, Tuple&& t, std::index_sequence<S...>)
|
||||
{
|
||||
return (object .* std::forward<F>(fn))(std::get<S>(std::forward<Tuple>(t))...);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue