From 1baf1c073475a162f14022b442a45f024067350c Mon Sep 17 00:00:00 2001 From: "m.milanovic@levi9.com" Date: Fri, 22 Aug 2014 16:32:13 +0200 Subject: [PATCH 1/3] Fixed one more undefined defines errors. --- examples/20-nanovg/nanovg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/20-nanovg/nanovg.cpp b/examples/20-nanovg/nanovg.cpp index a504f564..b4b9d1e0 100644 --- a/examples/20-nanovg/nanovg.cpp +++ b/examples/20-nanovg/nanovg.cpp @@ -984,7 +984,7 @@ void freeDemoData(struct NVGcontext* vg, struct DemoData* data) nvgDeleteImage(vg, data->images[i]); } -#if _MSC_VER < 1800 +#if defined(_MSC_VER) && (_MSC_VER < 1800) inline float round(float _f) { return float(int(_f) ); From 5aaddfccb9145a4009b8764432d2afa0c457307a Mon Sep 17 00:00:00 2001 From: "m.milanovic@levi9.com" Date: Fri, 22 Aug 2014 16:35:30 +0200 Subject: [PATCH 2/3] Use tinystl/unordered_map instead of c++11 only implementation --- examples/14-shadowvolumes/shadowvolumes.cpp | 6 ++++-- examples/common/entry/cmd.cpp | 8 +++++--- examples/common/entry/input.cpp | 11 +++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index 00667396..d60747bb 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -8,8 +8,10 @@ #include #include -#include #include +#include +#include +namespace stl = tinystl; namespace std { namespace tr1 {} } using namespace std::tr1; @@ -695,7 +697,7 @@ struct HalfEdges { m_data = (HalfEdge*)malloc(2 * _numIndices * sizeof(HalfEdge) ); - std::unordered_map > edges; + stl::unordered_map > edges; for (uint32_t ii = 0; ii < _numIndices; ii+=3) { uint16_t idx0 = _indices[ii]; diff --git a/examples/common/entry/cmd.cpp b/examples/common/entry/cmd.cpp index 81b4c601..fa5c7b09 100644 --- a/examples/common/entry/cmd.cpp +++ b/examples/common/entry/cmd.cpp @@ -13,7 +13,9 @@ #include "dbg.h" #include "cmd.h" #include -#include +#include +#include +namespace stl = tinystl; struct CmdContext { @@ -30,7 +32,7 @@ struct CmdContext uint32_t cmd = bx::hashMurmur2A(_name, (uint32_t)strlen(_name) ); BX_CHECK(m_lookup.end() == m_lookup.find(cmd), "Command \"%s\" already exist.", _name); Func fn = { _fn, _userData }; - m_lookup.insert(std::make_pair(cmd, fn) ); + m_lookup.insert(stl::make_pair(cmd, fn) ); } void exec(const char* _cmd) @@ -82,7 +84,7 @@ struct CmdContext void* m_userData; }; - typedef std::unordered_map CmdLookup; + typedef stl::unordered_map CmdLookup; CmdLookup m_lookup; }; diff --git a/examples/common/entry/input.cpp b/examples/common/entry/input.cpp index 6ab67617..681cc809 100644 --- a/examples/common/entry/input.cpp +++ b/examples/common/entry/input.cpp @@ -5,11 +5,14 @@ #include #include -#include #include "entry_p.h" #include "input.h" +#include +#include +namespace stl = tinystl; + struct Mouse { Mouse() @@ -112,12 +115,12 @@ struct Input void addBindings(const char* _name, const InputBinding* _bindings) { - m_inputBindingsMap.insert(std::make_pair(_name, _bindings) ); + m_inputBindingsMap.insert(stl::make_pair(_name, _bindings) ); } void removeBindings(const char* _name) { - m_inputBindingsMap.erase(_name); + m_inputBindingsMap.erase(m_inputBindingsMap.find(_name)); } void process(const InputBinding* _bindings) @@ -169,7 +172,7 @@ struct Input m_keyboard.reset(); } - typedef std::unordered_map InputBindingMap; + typedef stl::unordered_map InputBindingMap; InputBindingMap m_inputBindingsMap; Mouse m_mouse; Keyboard m_keyboard; From 8e57c9fa2b293a637dd55469be84b98439cffaf1 Mon Sep 17 00:00:00 2001 From: "m.milanovic@levi9.com" Date: Fri, 22 Aug 2014 16:51:25 +0200 Subject: [PATCH 3/3] Use tinystl/unordered_map in geometry --- tools/geometryc/geometryc.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/geometryc/geometryc.cpp b/tools/geometryc/geometryc.cpp index 6e85f979..2157e050 100644 --- a/tools/geometryc/geometryc.cpp +++ b/tools/geometryc/geometryc.cpp @@ -13,7 +13,9 @@ #include #include #include -#include +#include +#include +namespace stl = tinystl; #include @@ -79,7 +81,7 @@ struct Index3 int32_t m_vertexIndex; }; -typedef std::unordered_map Index3Map; +typedef stl::unordered_map Index3Map; struct Triangle { @@ -478,7 +480,7 @@ int main(int _argc, const char* _argv[]) uint64_t hash2 = uint64_t(index.m_normal)<<40; uint64_t hash = hash0^hash1^hash2; - std::pair result = indexMap.insert(std::make_pair(hash, index) ); + stl::pair result = indexMap.insert(stl::make_pair(hash, index) ); if (!result.second) { Index3& oldIndex = result.first->second;