Merge branch 'MiscellaneousImprovements' of git://github.com/intolerantape/FlaxEngine into intolerantape-MiscellaneousImprovements
This commit is contained in:
@@ -530,7 +530,7 @@ public:
|
||||
for (int32 i = 0; i < oldSize; i++)
|
||||
{
|
||||
if (oldData[i].IsOccupied())
|
||||
Add(oldData[i].Key, oldData[i].Value);
|
||||
Add(oldData[i].Key, MoveTemp(oldData[i].Value));
|
||||
}
|
||||
}
|
||||
if (oldElementsCount != 0)
|
||||
|
||||
@@ -89,6 +89,20 @@ public:
|
||||
_lambda = nullptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Function"/> class.
|
||||
/// </summary>
|
||||
template<typename T>
|
||||
Function(const T& lambda)
|
||||
{
|
||||
_lambda = (Lambda*)Allocator::Allocate(sizeof(Lambda) + sizeof(T));
|
||||
_lambda->Refs = 1;
|
||||
_lambda->Dtor = [](void* callee) -> void { static_cast<T*>(callee)->~T(); };
|
||||
_function = [](void* callee, Params ... params) -> ReturnType { return (*static_cast<T*>(callee))(Forward<Params>(params)...); };
|
||||
_callee = (byte*)_lambda + sizeof(Lambda);
|
||||
new(_callee) T(lambda);
|
||||
}
|
||||
|
||||
Function(const Function& other)
|
||||
: _callee(other._callee)
|
||||
, _function(other._function)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
|
||||
#include "Math.h"
|
||||
#include "Mathd.h"
|
||||
#include "Vector3.h"
|
||||
|
||||
void Math::SinCos(float angle, float& sine, float& cosine)
|
||||
@@ -9,6 +10,12 @@ void Math::SinCos(float angle, float& sine, float& cosine)
|
||||
cosine = Math::Cos(angle);
|
||||
}
|
||||
|
||||
void Math::SinCos(double angle, double& sine, double& cosine)
|
||||
{
|
||||
sine = Math::Sin(angle);
|
||||
cosine = Math::Cos(angle);
|
||||
}
|
||||
|
||||
uint32 Math::FloorLog2(uint32 value)
|
||||
{
|
||||
// References:
|
||||
|
||||
@@ -248,6 +248,19 @@ public:
|
||||
/// <returns>Task</returns>
|
||||
static Task* StartNew(Function<void()>::Signature action, Object* target = nullptr);
|
||||
|
||||
/// <summary>
|
||||
/// Starts the new task.
|
||||
/// </summary>
|
||||
/// <param name="callee">The callee object.</param>
|
||||
/// <returns>Task</returns>
|
||||
template<class T, void(T::* Method)()>
|
||||
static Task* StartNew(T* callee)
|
||||
{
|
||||
Function<void()> action;
|
||||
action.Bind<T, Method>(callee);
|
||||
return StartNew(action, dynamic_cast<Object*>(callee));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the new task.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user