Use std::piecewise_construct
parent
6431134310
commit
a2e2f397c6
|
@ -18,7 +18,12 @@ Stats::CounterRef Stats::GetOrCreateCounter(std::string str, bool resetOnNewFram
|
|||
|
||||
m_counterMutex.lock();
|
||||
m_definedCounters.emplace(hash, str);
|
||||
m_counters.emplace(hash, resetOnNewFrame);
|
||||
|
||||
// Use std::piecewise_construct, as it's the only overload for non-copyable,
|
||||
// non-movable objects like std::atomic
|
||||
m_counters.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(hash),
|
||||
std::forward_as_tuple(resetOnNewFrame));
|
||||
m_counterMutex.unlock();
|
||||
|
||||
return CounterRef(hash);
|
||||
|
|
|
@ -70,8 +70,8 @@ namespace Perf {
|
|||
static const size_t MAX_FRAME_COUNT = 10;
|
||||
|
||||
struct Counter {
|
||||
Counter(bool r) :
|
||||
ctr(0), resetOnNewFrame(r) {}
|
||||
Counter(bool reset) :
|
||||
resetOnNewFrame(reset){};
|
||||
std::atomic<uint32_t> ctr;
|
||||
bool resetOnNewFrame;
|
||||
};
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
#include "LuaVector2.h"
|
||||
#include "OS.h"
|
||||
#include "Pi.h"
|
||||
#include "pigui/PiGui.h"
|
||||
#include "Player.h"
|
||||
#include "Random.h"
|
||||
#include "SectorView.h"
|
||||
#include "WorldView.h"
|
||||
#include "buildopts.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "pigui/PiGui.h"
|
||||
#include "scenegraph/Model.h"
|
||||
#include "sound/Sound.h"
|
||||
#include "sound/SoundMusic.h"
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include "LuaVector.h"
|
||||
#include "LuaVector2.h"
|
||||
#include "Pi.h"
|
||||
#include "pigui/PiGui.h"
|
||||
#include "Player.h"
|
||||
#include "Space.h"
|
||||
#include "SystemInfoView.h"
|
||||
#include "WorldView.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "pigui/LuaFlags.h"
|
||||
#include "pigui/PiGui.h"
|
||||
#include "ship/PlayerShipController.h"
|
||||
#include "sound/Sound.h"
|
||||
#include "ui/Context.h"
|
||||
|
@ -759,8 +759,6 @@ static int l_pigui_selectable(lua_State *l)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Function: text
|
||||
*
|
||||
|
@ -876,7 +874,6 @@ static int l_pigui_text_wrapped(lua_State *l)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Function: textColored
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue